Initial import
authorkraftb <kraftb@735d13b6-9817-0410-8766-e36946ffe9aa>
Thu, 11 Mar 2010 12:13:23 +0000 (12:13 +0000)
committerkraftb <kraftb@735d13b6-9817-0410-8766-e36946ffe9aa>
Thu, 11 Mar 2010 12:13:23 +0000 (12:13 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/kb_packman/trunk@31013 735d13b6-9817-0410-8766-e36946ffe9aa

23 files changed:
Changelog [new file with mode: 0755]
README [new file with mode: 0755]
class.tx_kbpackman.php [new file with mode: 0755]
class.tx_kbpackman_cm1.php [new file with mode: 0755]
class.tx_kbpackman_dam.php [new file with mode: 0755]
cm1/clear.gif [new file with mode: 0755]
cm1/cm_icon_compress_dir.gif [new file with mode: 0755]
cm1/cm_icon_compress_file.gif [new file with mode: 0755]
cm1/cm_icon_unpack.gif [new file with mode: 0755]
cm1/cm_icon_unpack_overwrite.gif [new file with mode: 0755]
cm1/conf.php [new file with mode: 0755]
cm1/index.php [new file with mode: 0755]
cm1/locallang.xml [new file with mode: 0755]
doc/.~lock.manual.sxw# [new file with mode: 0755]
doc/manual.sxw [new file with mode: 0755]
ext_autoload.php [new file with mode: 0755]
ext_conf_template.txt [new file with mode: 0755]
ext_emconf.php [new file with mode: 0755]
ext_icon.gif [new file with mode: 0755]
ext_icon_alt.gif [new file with mode: 0755]
ext_localconf.php [new file with mode: 0755]
ext_tables.php [new file with mode: 0755]
locallang.xml [new file with mode: 0755]

diff --git a/Changelog b/Changelog
new file mode 100755 (executable)
index 0000000..51364be
--- /dev/null
+++ b/Changelog
@@ -0,0 +1,33 @@
+2010-03-11  Bernhard Kraft  <kraftb@think-open.at>
+
+       * Added support for RAR files
+       * Fixed create archive support for tar.gz and tar.bz2
+       * Fixed locallang issues
+       * Reindexed with extdeveval and added missing PHPdoc
+       * Uploaded extension to forge SVN
+
+2008-03-11  Bernhard Kraft  <kraftb@think-open.at>
+
+       * Corrected a bug: Extension only worked properly when DAM is installed. Now it works fine also without DAM (When configured correctly in the EM) - thx to Clemens Riccabona for reporting this bug.
+
+2008-02-28  Bernhard Kraft  <kraftb@think-open.at>
+
+       * Initial release as "kb_packman" (Copy of kb_unpack 0.1.0)
+       * Added support for compressing directories and files into a zip-file
+
+2006-04-14  Bernhard Kraft  <kraftb@think-open.at>
+
+       * Added support for filename with spaces inside. Thanks to Michiel Roos from netcreators for pointing this issue out.
+       * Set extension state to stable.
+
+2005-03-20  Bernhard Kraft  <kraftb@gmx.net>
+
+       * Reindexed it with extdeveval
+
+2005-??-??  Bernhard Kraft  <kraftb@gmx.net>
+
+       * Made it CGL360 compliant. Hope to get reviewed.
+
+2005-??-??  Bernhard Kraft  <kraftb@gmx.net>
+
+       * Initial release
diff --git a/README b/README
new file mode 100755 (executable)
index 0000000..3ba2fc0
--- /dev/null
+++ b/README
@@ -0,0 +1,40 @@
+tx_damindex_rule_recursive             enabled 1
+
+tx_damindex_rule_folderAsCat           enabled 0
+                                       fuzzy   0
+
+tx_damindex_rule_doReindexing          enabled 0
+                                       mode    0
+
+tx_damindex_rule_dryRun                        enabled 0
+
+tx_damdemo_indexRule                   enabled 0
+                                       option1 0
+
+tx_damindex_rule_devel                 enabled 0
+
+
+# mod.tx_kbpackman.dam.pack_file.ruleConf {
+# mod.tx_kbpackman.dam.pack_dir.ruleConf {
+# mod.tx_kbpackman.dam.unpack.ruleConf {
+# mod.tx_kbpackman.dam.unpack_overwrite.ruleConf {
+
+mod.tx_kbpackman.dam.unpack.ruleConf {
+       tx_damindex_rule_recursive.enabled = 1
+       tx_damindex_rule_dryRun.enabled = 0
+}
+
+
+// Do not overrule if already set
+mod.tx_kbpackman.dam.unpack.dataPreset {
+       
+}
+
+// Overrule when already set
+mod.tx_kbpackman.dam.unpack.dataPostset {
+       title = hugo 123
+}
+
+mod.tx_kbpackman.dam.unpack_overwrite < mod.tx_kbpackman.dam.unpack
+mod.tx_kbpackman.dam.pack_dir < mod.tx_kbpackman.dam.unpack
+
diff --git a/class.tx_kbpackman.php b/class.tx_kbpackman.php
new file mode 100755 (executable)
index 0000000..3608e27
--- /dev/null
@@ -0,0 +1,532 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2004-2010 Kraft Bernhard (kraftb@think-open.at)
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+/**
+ * Addition of an item to the clickmenu
+ *
+ * $Id$
+ *
+ * @author     Kraft Bernhard <kraftb@think-open.at>
+ * @package TYPO3
+ * @subpackage tx_kbpackman
+ */
+/**
+ * [CLASS/FUNCTION INDEX of SCRIPT]
+ *
+ *
+ *
+ *   67: class tx_kbpackman
+ *   75:     function __construct()
+ *   86:     function isCompressed($file)
+ *  113:     function checkForbidden($files, $theDest)
+ *  129:     function getList($file)
+ *  152:     function zipGetList($file)
+ *  169:     function rarGetList($file)
+ *  185:     function targzGetList($file)
+ *  199:     function tarbz2GetList($file)
+ *  215:     function pack($source, $targetName)
+ *  238:     function unpack($file)
+ *  263:     function zipPack($file, $targetFile)
+ *  289:     function zipUnpack($file)
+ *  320:     function getFileResult($list, $type = 'zip')
+ *  362:     function rarUnpack($file)
+ *  392:     function rarPack($file, $targetFile)
+ *  414:     function targzPack($file, $targetFile)
+ *  435:     function tarbz2Pack($file, $targetFile)
+ *  454:     function targzUnpack($file)
+ *  480:     function tarbz2Unpack($file)
+ *  507:     function getTarget($current, $file = 0)
+ *
+ * TOTAL FUNCTIONS: 20
+ * (This index is automatically created/updated by the extension "extdeveval")
+ *
+ */
+
+require_once(PATH_t3lib.'class.t3lib_basicfilefunc.php');
+
+class tx_kbpackman     {
+       var $overwrite = 0;
+
+       /**
+        * The constructor for the packman API
+        *
+        * @return      void
+        */
+       function __construct()  {
+               $this->basicFileFunc = t3lib_div::makeInstance('t3lib_basicFileFunctions');
+               $this->basicFileFunc->init($GLOBALS['FILEMOUNTS'],$TYPO3_CONF_VARS['BE']['fileExtensions']);
+       }
+
+       /**
+        * This function returns a listing of an compressed file for which we have defined wrappers
+        *
+        * @param       string          Compressed file for which listing should get generated
+        * @return      array           List of files in compressed file
+        */
+       function isCompressed($file)    {
+               // Handle ZIP Extensions
+               if (eregi('\.zip$', $file)) {
+                       return true;
+               }
+               // Handle RAR Extensions
+               if (eregi('\.rar$', $file)) {
+                       return true;
+               }
+               // Handle TAR.GZ Extensions
+               if (eregi('\.tar\.gz$', $file) || eregi('\.tgz$', $file)) {
+                       return true;
+               }
+               // Handle TAR.BZ2 Extensions
+               if (eregi('\.tar\.bz2$', $file) || eregi('\.tbz2$', $file)) {
+                       return true;
+               }
+               return false;
+       }
+
+       /**
+        * Returns if there are php files in the list of files
+        *
+        * @param       array           List of files
+        * @param       string          Destination which to check
+        * @return      bool            PHP file is in list of files
+        */
+       function checkForbidden($files, $theDest)       {
+               foreach($files as $file) {
+                       $info = t3lib_div::split_fileref($file);
+                       if (!$this->basicFileFunc->checkIfAllowed($info['fileext'], $theDest, $file))   {
+                               return true;
+                       }
+               }
+               return false;
+       }
+
+       /**
+        * This function returns a listing of an compressed file for which we have defined wrappers
+        *
+        * @param       string          Compressed file for which listing should get generated
+        * @return      array           List of files in compressed file
+        */
+       function getList($file) {
+               if (preg_match('/\.zip$/', $file)) {
+                               // Handle ZIP Extensions
+                       return $this->zipGetList($file);
+               } elseif (preg_match('/\.rar$/', $file)) {
+                               // Handle RAR Extensions
+                       return $this->rarGetList($file);
+               } elseif (preg_match('/\.tar.gz$/', $file) || preg_match('/\.tgz$/', $file)) {
+                               // Handle TAR.GZ Extensions
+                       return $this->targzGetList($file);
+               } elseif (preg_match('/\.tar.bz2/', $file) || preg_match('/\.tbz2/', $file)) {
+                               // Handle TAR.BZ2 Extensions
+                       return $this->tarbz2GetList($file);
+               }
+               return false;
+       }
+
+       /**
+        * This function returns a filelisting of a zip file
+        *
+        * @param       string          Return list of files in zip file
+        * @return      array           List of files
+        */
+       function zipGetList($file)      {
+               $unzip = $GLOBALS['TYPO3_CONF_VARS']['BE']['unzip_path']?$GLOBALS['TYPO3_CONF_VARS']['BE']['unzip_path']:'unzip';
+               $cmd = $unzip.' -l '.escapeshellarg($file);
+               exec($cmd, $list, $ret);
+               if ($ret) {
+                       return array();
+               }
+               $result = $this->getFileResult($list, 'list-zip');
+               return $result;
+       }
+
+       /**
+        * This function returns a filelisting of a rar file
+        *
+        * @param       string          Return list of files in rar file
+        * @return      array           List of files
+        */
+       function rarGetList($file) {
+               $unrar = $GLOBALS['TYPO3_CONF_VARS']['BE']['unrar_path']?$GLOBALS['TYPO3_CONF_VARS']['BE']['unrar_path']:'unrar';
+               $cmd = $unrar.' vb '.escapeshellarg($file);
+               exec($cmd, $list, $ret);
+               if ($ret) {
+                       return array();
+               }
+               return $list;
+       }
+
+       /**
+        * This function returns a filelisting of a tar.gz file
+        *
+        * @param       string          Return list of files in tar.gz file
+        * @return      array           List of files
+        */
+       function targzGetList($file)    {
+               $cmd = 'tar -tzf '.escapeshellarg($file);
+               exec($cmd, $list, $ret);
+               if ($ret) {
+                       return array();
+               }
+               return $list;
+       }
+       /**
+        * This function returns a filelisting of a tar.bz2 file
+        *
+        * @param       string          Return list of files in tar.bz2 file
+        * @return      array           List of files
+        */
+       function tarbz2GetList($file)   {
+               $cmd = 'tar -tjf '.escapeshellarg($file);
+               exec($cmd, $list, $ret);
+               if ($ret) {
+                       return array();
+               }
+               return $list;
+       }
+
+       /**
+        * This method is a wrapper for extracting the passed source file to the specified destination with one of the supported archive types
+        *
+        * @param       string          The archive file
+        * @param       string          The destination path to which to extract the archive
+        * @return      array           A list of the extracted files
+        */
+       function pack($source, $targetName) {
+               if (preg_match('/\.zip$/', $targetName)) {
+                               // Handle ZIP Extensions
+                       return $this->zipPack($source, $targetName);
+               } elseif (preg_match('/\.rar$/', $targetName)) {
+                               // Handle RAR Extensions
+                       return $this->rarPack($source, $targetName);
+               } elseif (preg_match('/\.tar.gz$/', $targetName) || preg_match('/\.tgz$/', $targetName)) {
+                               // Handle TAR.GZ Extensions
+                       return $this->targzPack($source, $targetName);
+               } elseif (preg_match('/\.tar.bz2/', $targetName) || preg_match('/\.tbz2/', $targetName)) {
+                               // Handle TAR.BZ2 Extensions
+                       return $this->tarbz2Pack($source, $targetName);
+               }
+               return false;
+       }
+
+       /**
+        * This function returns the files extracted by the call to the specific unpack-wrapper for the supplied file
+        *
+        * @param       string          File to unpack
+        * @return      array           Files unpacked
+        */
+       function unpack($file)  {
+               if (preg_match('/\.zip$/', $file)) {
+                               // Handle ZIP Extensions
+                       return $this->zipUnpack($file);
+               } elseif (preg_match('/\.rar$/', $file)) {
+                               // Handle RAR Extensions
+                       return $this->rarUnpack($file);
+               } elseif (preg_match('/\.tar.gz$/', $file) || preg_match('/\.tgz$/', $file)) {
+                               // Handle TAR.GZ Extensions
+                       return $this->targzUnpack($file);
+               } elseif (preg_match('/\.tar.bz2$/', $file) || preg_match('/\.tbz2$/', $file)) {
+                               // Handle TAR.BZ2 Extensions
+                       return $this->tarbz2Unpack($file);
+               }
+               return false;
+       }
+
+       /**
+        * This function creates a zip file
+        *
+        * @param       string          File/Directory to pack
+        * @param       string          Zip-file target directory
+        * @param       string          Zip-file target name
+        * @return      array           Files packed
+        */
+       function zipPack($file, $targetFile)    {
+               if (!(isset($GLOBALS['TYPO3_CONF_VARS']['BE']['unzip']['unzip']['split_char'])&&
+                 isset($GLOBALS['TYPO3_CONF_VARS']['BE']['unzip']['unzip']['pre_lines']) &&
+                 isset($GLOBALS['TYPO3_CONF_VARS']['BE']['unzip']['unzip']['post_lines']) &&
+                 isset($GLOBALS['TYPO3_CONF_VARS']['BE']['unzip']['unzip']['file_pos']))) {
+                       return array();
+               }
+               $zip = $GLOBALS['TYPO3_CONF_VARS']['BE']['zip_path']?$GLOBALS['TYPO3_CONF_VARS']['BE']['zip_path']:'zip';
+               $path = dirname($file);
+               $file = basename($file);
+               chdir($path);
+               $cmd = $zip.' -r -9 '.escapeshellarg($targetFile).' '.escapeshellarg($file);
+               exec($cmd, $list, $ret);
+               if ($ret) {
+                       return array();
+               }
+               $result = $this->getFileResult($list, 'zip');
+               return $result;
+       }
+
+       /**
+        * This function unpacks a zip file
+        *
+        * @param       string          File to unpack
+        * @return      array           Files unpacked
+        */
+       function zipUnpack($file)       {
+               if (!(isset($GLOBALS['TYPO3_CONF_VARS']['BE']['unzip']['unzip']['split_char'])&&
+                 isset($GLOBALS['TYPO3_CONF_VARS']['BE']['unzip']['unzip']['pre_lines']) &&
+                 isset($GLOBALS['TYPO3_CONF_VARS']['BE']['unzip']['unzip']['post_lines']) &&
+                 isset($GLOBALS['TYPO3_CONF_VARS']['BE']['unzip']['unzip']['file_pos']))) {
+                       return array();
+               }
+               $path = dirname($file);
+               chdir($path);
+               // Unzip without overwriting existing files
+               $unzip = $GLOBALS['TYPO3_CONF_VARS']['BE']['unzip_path']?$GLOBALS['TYPO3_CONF_VARS']['BE']['unzip_path']:'unzip';
+               if ($this->overwrite) {
+                       $cmd = $unzip.' -o '.escapeshellarg($file);
+               } else {
+                       $cmd = $unzip.' -n '.escapeshellarg($file);
+               }
+               exec($cmd, $list, $ret);
+               if ($ret) {
+                       return array();
+               }
+               $result = $this->getFileResult($list, 'unzip');
+               return $result;
+       }
+
+       /**
+        * This method helps filtering the output of the various archive binaries to get a clean php array
+        *
+        * @param       array           The output of the executed archive binary
+        * @param       string          The type/configuration for which to parse the output
+        * @return      array           A clean list of the filenames returned by the binary
+        */
+       function getFileResult($list, $type = 'zip')    {
+               $sc = $GLOBALS['TYPO3_CONF_VARS']['BE']['unzip'][$type]['split_char'];
+               $pre = intval($GLOBALS['TYPO3_CONF_VARS']['BE']['unzip'][$type]['pre_lines']);
+               $post = intval($GLOBALS['TYPO3_CONF_VARS']['BE']['unzip'][$type]['post_lines']);
+               $pos = intval($GLOBALS['TYPO3_CONF_VARS']['BE']['unzip'][$type]['file_pos']);
+
+                       // Removing trailing lines
+               while ($post--) {
+                       array_pop($list);
+               }
+
+                       // Only last lines
+               if ($pre === -1) {
+                       $fl = array();
+                       while ($line = trim(array_pop($list))) {
+                               array_unshift($fl, $line);
+                       }
+                       $list = $fl;
+               }
+
+                       // Remove preceeding lines
+               if ($pre > 0) {
+                       while ($pre--) {
+                               array_shift($list);
+                       }
+               }
+
+
+               $fl = array();
+               foreach ($list as $file) {
+                       $parts = preg_split('/'.preg_quote($sc).'+/', $file);
+                       $fl[] = trim($parts[$pos]);
+               }
+               return $fl;
+       }
+
+       /**
+        * This function unpacks a rar file
+        *
+        * @param       string          File to unpack
+        * @return      array           Files unpacked
+        */
+       function rarUnpack($file) {
+               $unrar = $GLOBALS['TYPO3_CONF_VARS']['BE']['unrar_path']?$GLOBALS['TYPO3_CONF_VARS']['BE']['unrar_path']:'unrar';
+               $path = dirname($file);
+               chdir($path);
+               if ($this->overwrite) {
+                       $cmd = $unrar.' x -o+ -idcd -y '.escapeshellarg($file);
+               } else {
+                       $cmd = $unrar.' x -o- -idcd -y '.escapeshellarg($file);
+               }
+               exec($cmd, $list, $ret);
+               if ($this->overwrite) {
+                       // We are in overwrite mode
+                       // Check if return value of
+                       // exec is set == Error
+                       if ($ret) {
+                               return array();
+                       }
+               }
+               $result = $this->getFileResult($list, 'unrar');
+               return $result;
+       }
+
+       /**
+        * This function creates a rar file
+        *
+        * @param       string          File/Directory to pack
+        * @param       string          RAR-file target directory
+        * @param       string          RAR-file target name
+        * @return      array           Files packed
+        */
+       function rarPack($file, $targetFile) {
+               $rar = $GLOBALS['TYPO3_CONF_VARS']['BE']['rar_path']?$GLOBALS['TYPO3_CONF_VARS']['BE']['rar_path']:'rar';
+               $path = dirname($file);
+               $file = basename($file);
+               chdir($path);
+               $cmd = $rar.' a -r -idcd -m5 '.escapeshellarg($targetFile).' '.escapeshellarg($file);
+               exec($cmd, $list, $ret);
+               if ($ret) {
+                       return array();
+               }
+               $result = $this->getFileResult($list, 'rar');
+               return $result;
+       }
+
+       /**
+        * This function creates a tar.gz file
+        *
+        * @param       string          File/Directory to pack
+        * @param       string          tar.gz file target directory
+        * @param       string          tar.gz file target name
+        * @return      array           Files packed
+        */
+       function targzPack($file, $targetFile) {
+               $path = dirname($file);
+               $file = basename($file);
+               chdir($path);
+               $relTarget = str_replace($path.'/', '', $targetFile);
+               $cmd = 'tar -czv --exclude='.escapeshellarg($relTarget).' -f '.escapeshellarg($targetFile).' '.escapeshellarg($file);
+               exec($cmd, $list, $ret);
+               if ($ret) {
+                       return array();
+               }
+               return $list;
+       }
+
+       /**
+        * This function creates a tar.bz2 file
+        *
+        * @param       string          File/Directory to pack
+        * @param       string          tar.bz2 file target directory
+        * @param       string          tar.bz2 file target name
+        * @return      array           Files packed
+        */
+       function tarbz2Pack($file, $targetFile) {
+               $path = dirname($file);
+               $file = basename($file);
+               chdir($path);
+               $relTarget = str_replace($path.'/', '', $targetFile);
+               $cmd = 'tar -cjv --exclude='.escapeshellarg($relTarget).' -f '.escapeshellarg($targetFile).' '.escapeshellarg($file);
+               exec($cmd, $list, $ret);
+               if ($ret) {
+                       return array();
+               }
+               return $list;
+       }
+
+       /**
+        * This function unpacks a tar.gz file
+        *
+        * @param       string          File to unpack
+        * @return      array           Files unpacked
+        */
+       function targzUnpack($file)     {
+               $path = dirname($file);
+               chdir($path);
+               if ($this->overwrite) {
+                       $cmd = 'tar -xzvf '.escapeshellarg($file);
+               } else {
+                       $cmd = 'tar -xzvkf '.escapeshellarg($file);
+               }
+               exec($cmd, $list, $ret);
+               if ($this->overwrite) {
+                       // We are in overwrite mode
+                       // Check if return value of
+                       // exec is set == Error
+                       if ($ret) {
+                               return array();
+                       }
+               }
+               return $list;
+       }
+
+       /**
+        * This function unpacks a tar.bz2 file
+        *
+        * @param       string          File to unpack
+        * @return      array           Files unpacked
+        */
+       function tarbz2Unpack($file)    {
+               $path = dirname($file);
+               chdir($path);
+               if ($this->overwrite) {
+                       $cmd = 'tar -xjvf '.escapeshellarg($file);
+               } else {
+                       $cmd = 'tar -xjvkf '.escapeshellarg($file);
+               }
+               exec($cmd, $list, $ret);
+               if ($this->overwrite) {
+                       // We are in overwrite mode
+                       // Check if return value of
+                       // exec is set == Error
+                       if ($ret) {
+                               return array();
+                       }
+               }
+               return $list;
+       }
+
+       /**
+        * This method returns the filesystem name for the specified target
+        *
+        * @param       string          The current path
+        * @param       string          When set the target should be a file
+        * @return      string          The final target path for the archive
+        */
+       function getTarget($current, $file = 0) {
+               if ($file)      {
+                       $dirTarget = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kb_packman']['fileTarget'];
+               } else  {
+                       $dirTarget = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kb_packman']['dirTarget'];
+               }
+               if (substr($dirTarget, 0, 1)=='.')      {
+                       $dirTarget = $current.$dirTarget;
+               } else  {
+                       $dirTarget = PATH_site.$dirTarget;
+               }
+               $dirTarget = str_replace('/./', '/', t3lib_div::resolveBackPath($dirTarget));
+               if (substr($dirTarget, -1)!='/')        {
+                       $dirTarget .= '/';
+               }
+               return $dirTarget;
+       }
+
+}
+
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/kb_packman/ux.kbpacman.php']) {
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/kb_packman/ux.kbpacman.php']);
+}
+
+
+?>
diff --git a/class.tx_kbpackman_cm1.php b/class.tx_kbpackman_cm1.php
new file mode 100755 (executable)
index 0000000..c96fe65
--- /dev/null
@@ -0,0 +1,199 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2004-2010 Kraft Bernhard (kraftb@think-open.at)
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+/**
+ * Addition of an item to the clickmenu
+ *
+ * $Id$
+ *
+ * @author     Kraft Bernhard <kraftb@think-open.at>
+ * @package TYPO3
+ * @subpackage tx_kbpackman
+ */
+/**
+ * [CLASS/FUNCTION INDEX of SCRIPT]
+ *
+ *
+ *
+ *   53: class tx_kbpackman_cm1
+ *   61:     function init()
+ *   83:     function main(&$backRef,$menuItems,$table,$uid)
+ *  136:     function menuItemsDir($table, $uid, $menuItems, &$backRef)
+ *  163:     function menuItemsFile($table, $uid, $menuItems, &$backRef)
+ *  186:     function includeLL()
+ *
+ * TOTAL FUNCTIONS: 5
+ * (This index is automatically created/updated by the extension "extdeveval")
+ *
+ */
+
+
+require_once(PATH_t3lib.'class.t3lib_div.php');
+
+class tx_kbpackman_cm1 {
+
+
+       /**
+        * Initalizing the clickmenu hook
+        *
+        * @return      void
+        */
+       function init() {
+                       // Adds the regular item:
+               $this->LL = $this->includeLL();
+               $this->filefunc = t3lib_div::makeInstance('t3lib_basicFileFunctions');
+               $this->filefunc->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
+               $this->dirTarget = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kb_packman']['dirTarget'];
+               $this->fileTarget = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kb_packman']['fileTarget'];
+               $this->pacman = t3lib_div::makeInstance('tx_kbpackman');
+       }
+
+
+
+
+       /**
+        * Returns the list of menuitems in the clickmenu with the new fields appended
+        *
+        * @param       object          back reference
+        * @param       array           menu items
+        * @param       string          the table or file on which was clicked
+        * @param       uid             the uid on which was clicked
+        * @return      array           menu items
+        */
+       function main(&$backRef,$menuItems,$table,$uid) {
+               global $BE_USER,$TCA,$LANG;
+
+               $localItems = array();
+               if (!$backRef->cmLevel) {
+
+                       $this->useBackPath = '###BACK_PATH###';
+
+                       if (@is_dir($table))    {
+                               return $this->menuItemsDir($table, $uid, $menuItems, $backRef);
+                       } elseif (!@is_file($table)) {
+                               return $menuItems;
+                       }
+                       $this->init();
+                       if (!$this->pacman->isCompressed($table)) {
+                               return $this->menuItemsFile($table, $uid, $menuItems, $backRef);
+                       }
+                       $dir = dirname($table).'/';
+                       $pathOK = $this->filefunc->checkPathAgainstMounts($dir);
+                       if (is_writeable($dir)&&(($pathOK&&($BE_USER->user['fileoper_perms']&0x1)&&($BE_USER->user['fileoper_perms']&0x2)) || intval($BE_USER->isAdmin()))) {
+                               $enc = urlencode($table);
+                               $url = t3lib_extMgm::extRelPath('kb_packman').'cm1/index.php?id='.$uid.'&file='.$enc.'&returnURL='.rawurlencode(t3lib_div::linkThisScript());
+                               $localItems['unpack'] = $backRef->linkItem(
+                                       $GLOBALS['LANG']->getLLL('cm1_title',$this->LL),
+                                       $backRef->excludeIcon('<img src="'.$this->useBackPath.t3lib_extMgm::extRelPath('kb_packman').'cm1/cm_icon_unpack.gif" width="15" height="12" border=0 align=top>'),
+                                       $backRef->urlRefForCM($url),
+                                       0       // Disables the item in the top-bar. Set this to zero if you with the item to appear in the top bar!
+                               );
+
+                               $url = t3lib_extMgm::extRelPath('kb_packman').'cm1/index.php?id='.$uid.'&file='.$enc.'&overwrite=1&returnURL='.rawurlencode(t3lib_div::linkThisScript());
+                               $localItems['unpack_overwrite'] = $backRef->linkItem(
+                                       $GLOBALS['LANG']->getLLL('cm1_title_overwrite',$this->LL),
+                                       $backRef->excludeIcon('<img src="'.$this->useBackPath.t3lib_extMgm::extRelPath('kb_packman').'cm1/cm_icon_unpack_overwrite.gif" width="15" height="12" border=0 align=top>'),
+                                       $backRef->urlRefForCM($url),
+                                       0       // Disables the item in the top-bar. Set this to zero if you with the item to appear in the top bar!
+                               );
+                               $menuItems=array_merge($menuItems,$localItems);
+                       }
+               }
+
+
+               return $menuItems;
+       }
+
+       /**
+        * Generate a list of menu itesm for a directory
+        *
+        * @param       string          The directory being clicked on (Usually table of record being clicked)
+        * @param       string          Not valid in this context (Usually UID of record being clicked)
+        * @param       array           Current clickmenu items
+        * @param       object          Pointer to the parent object
+        * @return      array           The clickmenu items containing options for the packman extension if applicable
+        */
+       function menuItemsDir($table, $uid, $menuItems, &$backRef)      {
+               global $BE_USER;
+               $this->init();
+               $dirTarget = $this->pacman->getTarget($table);
+               $pathOK = $this->filefunc->checkPathAgainstMounts($dirTarget);
+               if (is_writeable($dirTarget)&&(($pathOK&&($BE_USER->user['fileoper_perms']&0x1)) || intval($BE_USER->isAdmin()))) {
+                       $enc = urlencode($table);
+                       $url = t3lib_extMgm::extRelPath('kb_packman').'cm1/index.php?id='.$uid.'&comp='.$enc;
+                       $menuItems[] = $backRef->linkItem(
+                               $GLOBALS['LANG']->getLLL('cm1_title_compress', $this->LL),
+                               $backRef->excludeIcon('<img src="'.$this->useBackPath.t3lib_extMgm::extRelPath('kb_packman').'cm1/cm_icon_compress_dir.gif" width="15" height="12" border=0 align=top>'),
+                               $backRef->urlRefForCM($url),
+                               1       // Disables the item in the top-bar. Set this to zero if you with the item to appear in the top bar!
+                       );
+               }
+               return $menuItems;
+       }
+
+       /**
+        * Generate a list of menu itesm for a directory
+        *
+        * @param       string          The file being clicked on (Usually table of record being clicked)
+        * @param       string          Not valid in this context (Usually UID of record being clicked)
+        * @param       array           Current clickmenu items
+        * @param       object          Pointer to the parent object
+        * @return      array           The clickmenu items containing options for the packman extension if applicable
+        */
+       function menuItemsFile($table, $uid, $menuItems, &$backRef)     {
+               global $BE_USER;
+               $fromDir = dirname($table).'/';
+               $dirTarget = $this->pacman->getTarget($fromDir, 1);
+               $pathOK = $this->filefunc->checkPathAgainstMounts($dirTarget);
+               if (is_writeable($dirTarget)&&(($pathOK&&($BE_USER->user['fileoper_perms']&0x1)) || intval($BE_USER->isAdmin()))) {
+                       $enc = urlencode($table);
+                       $url = t3lib_extMgm::extRelPath('kb_packman').'cm1/index.php?id='.$uid.'&comp='.$enc;
+                       $menuItems[] = $backRef->linkItem(
+                               $GLOBALS['LANG']->getLLL('cm1_title_compress', $this->LL),
+                               $backRef->excludeIcon('<img src="'.$this->useBackPath.t3lib_extMgm::extRelPath('kb_packman').'cm1/cm_icon_compress_file.gif" width="15" height="12" border=0 align=top>'),
+                               $backRef->urlRefForCM($url),
+                               1       // Disables the item in the top-bar. Set this to zero if you with the item to appear in the top bar!
+                       );
+               }
+               return $menuItems;
+       }
+
+       /**
+        * Includes the [extDir]/locallang.xml and returns the associated LOCAL_LANG array
+        *
+        * @return      array           Locallang array
+        */
+       function includeLL() {
+               return $GLOBALS['LANG']->includeLLFile('EXT:kb_packman/locallang.xml', 0);
+       }
+
+
+}
+
+
+
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/kb_packman/class.tx_kbpackman_cm1.php'])      {
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/kb_packman/class.tx_kbpackman_cm1.php']);
+}
+
+?>
diff --git a/class.tx_kbpackman_dam.php b/class.tx_kbpackman_dam.php
new file mode 100755 (executable)
index 0000000..8350744
--- /dev/null
@@ -0,0 +1,71 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2008-2010 Kraft Bernhard (kraftb@think-open.at)
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+/**
+ * Integration of kb_packman into DAM
+ *
+ * $Id$
+ *
+ * @author     Kraft Bernhard <kraftb@think-open.at>
+ * @package TYPO3
+ * @subpackage tx_kbpackman
+ */
+/**
+ * [CLASS/FUNCTION INDEX of SCRIPT]
+ *
+ *
+ *
+ *   49: class tx_kbpackman_dam extends tx_damindex_index
+ *   58:     function indexSessionNew($filesTodo)
+ *
+ * TOTAL FUNCTIONS: 1
+ * (This index is automatically created/updated by the extension "extdeveval")
+ *
+ */
+
+
+require_once(t3lib_extMgm::extPath('dam_index').'modfunc_index/class.tx_damindex_index.php');
+
+class tx_kbpackman_dam extends tx_damindex_index       {
+
+
+       /**
+        * Handler for the DAM API to index new files
+        *
+        * @param       string          Serialized array of file to get indexed (which were extracted from an archive)
+        * @return      mixed           Return value of indexing method of DAM
+        */
+       function indexSessionNew($filesTodo) {
+               $filesTodo = unserialize($GLOBALS['SOBE']->MOD_SETTINGS['tx_kbpackman_dam_filesTodo']);
+               return parent::indexSessionNew($filesTodo);
+       }
+
+
+}
+
+
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/kb_packman/class.tx_kbpackman_dam.php'])      {
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/kb_packman/class.tx_kbpackman_dam.php']);
+}
+
+?>
diff --git a/cm1/clear.gif b/cm1/clear.gif
new file mode 100755 (executable)
index 0000000..9ed1269
Binary files /dev/null and b/cm1/clear.gif differ
diff --git a/cm1/cm_icon_compress_dir.gif b/cm1/cm_icon_compress_dir.gif
new file mode 100755 (executable)
index 0000000..63c7187
Binary files /dev/null and b/cm1/cm_icon_compress_dir.gif differ
diff --git a/cm1/cm_icon_compress_file.gif b/cm1/cm_icon_compress_file.gif
new file mode 100755 (executable)
index 0000000..6fb93f0
Binary files /dev/null and b/cm1/cm_icon_compress_file.gif differ
diff --git a/cm1/cm_icon_unpack.gif b/cm1/cm_icon_unpack.gif
new file mode 100755 (executable)
index 0000000..3c43d27
Binary files /dev/null and b/cm1/cm_icon_unpack.gif differ
diff --git a/cm1/cm_icon_unpack_overwrite.gif b/cm1/cm_icon_unpack_overwrite.gif
new file mode 100755 (executable)
index 0000000..3c43d27
Binary files /dev/null and b/cm1/cm_icon_unpack_overwrite.gif differ
diff --git a/cm1/conf.php b/cm1/conf.php
new file mode 100755 (executable)
index 0000000..f5c6130
--- /dev/null
@@ -0,0 +1,7 @@
+<?php
+
+       // DO NOT REMOVE OR CHANGE THESE 3 LINES:
+define('TYPO3_MOD_PATH', '../typo3conf/ext/kb_packman/cm1/');
+$BACK_PATH='../../../../typo3/';
+$MCONF["name"]="tx_kbpackman";
+?>
diff --git a/cm1/index.php b/cm1/index.php
new file mode 100755 (executable)
index 0000000..5dc2932
--- /dev/null
@@ -0,0 +1,432 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2004-2010 Kraft Bernhard (kraftb@think-open.at)
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+/**
+ * kb_packman module cm1
+ *
+ * $Id$
+ *
+ * @author     Kraft Bernhard <kraftb@think-open.at>
+ * @package TYPO3
+ * @subpackage tx_kbpackman
+ */
+/**
+ * [CLASS/FUNCTION INDEX of SCRIPT]
+ *
+ *
+ *
+ *   83: class tx_dam_SCbase extends t3lib_SCbase
+ *
+ *
+ *   91: class tx_kbpackman_module extends tx_dam_SCbase
+ *  101:     function init()
+ *  111:     function main()
+ *  137:     function jumpToUrl(URL)
+ *  169:     function printContent()
+ *  182:     function moduleContent()
+ *  304:     function setIndexData()
+ *  318:     function getIndexData_ruleConf()
+ *  339:     function getIndexData_fields($subConf)
+ *  358:     function storeFilesTodo($damFileList)
+ *  374:     function outputResult($header, $fileList, $param1 = '', $compProc = 0)
+ *  400:     function checkValidLocation()
+ *
+ * TOTAL FUNCTIONS: 11
+ * (This index is automatically created/updated by the extension "extdeveval")
+ *
+ */
+
+
+       // DEFAULT initialization of a module [BEGIN]
+unset($MCONF);
+require ('conf.php');
+require ($BACK_PATH.'init.php');
+require ($BACK_PATH.'template.php');
+$LANG->includeLLFile('EXT:kb_packman/cm1/locallang.php');
+require_once (PATH_t3lib.'class.t3lib_scbase.php');
+require_once (PATH_t3lib.'class.t3lib_basicfilefunc.php');
+       // ....(But no access check here...)
+       // DEFAULT initialization of a module [END]
+
+
+require_once(t3lib_extMgm::extPath('kb_packman').'class.tx_kbpackman.php');
+if ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$_EXTKEY]['DAMsupport']) {
+       require_once(t3lib_extMgm::extPath('dam').'lib/class.tx_dam_guirenderlist.php');
+       require_once(t3lib_extMgm::extPath('dam').'lib/class.tx_dam_scbase.php');
+       require_once(t3lib_extMgm::extPath('kb_packman').'class.tx_kbpackman_dam.php');
+} else {
+
+       /**
+        * Dummy DAM handler
+        *
+        */
+       class tx_dam_SCbase extends t3lib_SCbase {
+       }
+}
+
+       /**
+        * The kb_packman backend module handling compression / decompression in the fileadmin
+        *
+        */
+class tx_kbpackman_module extends tx_dam_SCbase        {
+       var $MOD_MENU = array(
+               'tx_kbpackman_dam_filesTodo' => '',
+       );
+
+       /**
+        * The initialization method for the packman module
+        *
+        * @return      void            nothing
+        */
+       function init() {
+               parent::init();
+               $this->menuConfig();
+       }
+
+       /**
+        * Main function of the module. Write the content to $this->content
+        *
+        * @return      void            nothing
+        */
+       function main() {
+               global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
+
+               if ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$_EXTKEY]['DAMsupport'])     {
+                       $this->guiItems = t3lib_div::makeInstance('tx_dam_guiRenderList');
+               }
+
+               $this->filefunc = t3lib_div::makeInstancE('t3lib_basicFileFunctions');
+               $this->filefunc->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
+               $this->dirTarget = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kb_packman']['dirTarget'];
+               $this->fileTarget = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kb_packman']['fileTarget'];
+               $this->targetExt = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kb_packman']['targetExt']?$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kb_packman']['targetExt']:'zip';
+
+                       // Draw the header.
+               $this->doc = t3lib_div::makeInstance('mediumDoc');
+               $this->doc->backPath = $BACK_PATH;
+               $this->doc->form='<form action="" method="POST">';
+
+               $this->file = t3lib_div::_GET('file');
+               $this->comp = t3lib_div::_GET('comp');
+               $this->overwrite = intval(t3lib_div::_GET('overwrite'));
+
+                       // JavaScript
+               $this->doc->JScode = '
+                       <script language="javascript" type="text/javascript">
+                               script_ended = 0;
+                               function jumpToUrl(URL) {
+                                       document.location = URL;
+                               }
+                       </script>
+               ';
+
+               $this->pageinfo=array('title' => 'File-List','uid'=>0,'pid'=>0);
+
+               $headerSection = $this->doc->getHeader('pages',$this->pageinfo,$this->pageinfo['_thePath']).'<br />'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.path').': '.t3lib_div::fixed_lgd_pre($this->pageinfo['_thePath'],50);
+
+               $this->content.=$this->doc->startPage($LANG->getLL('title'));
+               $this->content.=$this->doc->header($LANG->getLL('title'));
+               $this->content.=$this->doc->spacer(5);
+
+               // Render content:
+               $this->moduleContent();
+
+
+               // ShortCut
+               if ($BE_USER->mayMakeShortcut())        {
+                       $this->content.=$this->doc->spacer(20).$this->doc->section('',$this->doc->makeShortcutIcon('id',implode(',',array_keys($this->MOD_MENU)),$this->MCONF['name']));
+               }
+               $this->content.=$this->doc->spacer(10);
+       } // EOF: function main()
+
+
+
+       /**
+        * Prints out the content
+        *
+        * @return      void            nothing
+        */
+       function printContent() {
+               $this->content.=$this->doc->endPage();
+               $this->content = $this->doc->insertStylesAndJS($this->content);
+               echo $this->content;
+       } // EOF: function printContent()
+
+
+
+       /**
+        * Generate the module content
+        *
+        * @return      void            nothing
+        */
+       function moduleContent()        {
+               global $LANG, $BE_USER;
+               $head = $LANG->getLL('unpack_head');
+               $doIndexing = intval(t3lib_div::_GP('doIndexing'));
+               if (!$doIndexing && strlen($this->comp)) {
+                       $head = $LANG->getLL('pack_head');
+                       $pacman = t3lib_div::makeInstance('tx_kbpackman');
+                       $pacman->overwrite = $this->overwrite;
+
+                       $item = $this->comp;
+                       $isfile = 0;
+                       $what = '';
+                       if (@is_dir($item))     {
+                               $isfile = 0;
+                               $target = $item;
+                               $what = 'dir';
+                       } elseif (@is_file($item))      {
+                               $isfile = 1;
+                               $target = dirname($item).'/';
+                               $what = 'file';
+                       } else  {
+                               $content = 'Invalid file/directory selected !';
+                               $this->content.=$this->doc->section($LANG->getLL('unpack_head'),$content,0,1);
+                               return;
+                       }
+                       $dirTarget = $pacman->getTarget($target, $isfile);
+                       $pathOK = $this->filefunc->checkPathAgainstMounts($dirTarget);
+                       if (!(is_writeable($dirTarget)&&(($pathOK&&($BE_USER->user['fileoper_perms']&0x1)) || intval($BE_USER->user['admin'])))) {
+                               $content = 'You are not allowed to create files !';
+                               $this->content.=$this->doc->section($LANG->getLL('unpack_head'),$content,0,1);
+                               return;
+                       }
+
+                       $targetFile = str_replace('.', '_', basename($item)).'.'.$this->targetExt;
+                       $targetName = $this->filefunc->getUniqueName($targetFile, $dirTarget);
+
+                       $fileList = $pacman->pack($item, $targetName);
+                       $indexFileList = array($targetName);
+                       if (!$fileList || !count($fileList)) {;
+                               $content = 'No files in created archive (This shouldn\'t happen) !';
+                               $this->content.=$this->doc->section($LANG->getLL('unpack_head'),$content,0,1);
+                               return;
+                       }
+                       $outputReduced = ($this->targetExt == 'zip')?true:false;
+                       $content .= $this->outputResult($LANG->getLL('files_packed'), $fileList, basename($targetName), $outputReduced);
+                       $this->task = 'pack_'.$what;
+               } elseif ($this->file && @is_file($this->file) && !$doIndexing) {
+                       $dir = dirname($this->file).'/';
+                       $pathOK = $this->filefunc->checkPathAgainstMounts($dir);
+                       if (!(is_writeable($dir)&&(($pathOK&&($BE_USER->user['fileoper_perms']&0x1)&&($BE_USER->user['fileoper_perms']&0x2)) || intval($BE_USER->user['admin'])))) {
+                               $content = 'You are not allowed to unpack files !';
+                               $this->content.=$this->doc->section($LANG->getLL('unpack_head'),$content,0,1);
+                               return;
+                       }
+                       if (!$this->checkValidLocation()) {
+                               $content = 'You are not allowed to unpack files in this location !';
+                               $this->content.=$this->doc->section($LANG->getLL('unpack_head'),$content,0,1);
+                               return;
+                       }
+                       $pacman = t3lib_div::makeInstance('tx_kbpackman');
+                       $pacman->overwrite = $this->overwrite;
+                       $fileList = $pacman->getList($this->file);
+                       if (!$fileList || !count($fileList)) {;
+                               $content = 'No files in archive (This shouldn\'t happen) !';
+                               $this->content.=$this->doc->section($LANG->getLL('unpack_head'),$content,0,1);
+                               return;
+                       }
+                       if (!$BE_USER->user['admin']) {
+                               if ($pacman->checkForbidden($fileList, dirname($this->file))) {
+                                       $content = $LANG->getLL('files_not_allowed');
+                                       $this->content.=$this->doc->section($LANG->getLL('unpack_head'),$content,0,1);
+                                       return;
+                               }
+                       }
+                       $fileList = $pacman->unpack($this->file);
+                       $indexFileList = $fileList;
+                       $content .= $this->outputResult($LANG->getLL('files_unpacked'), $fileList);
+                       $this->task = 'unpack'.($this->overwrite?'_overwrite':'');
+               } elseif (!$doIndexing) {
+                       $content .= 'Invalid commands';
+               }
+               if (!$doIndexing)       {
+                       $this->content.=$this->doc->section($head,$content,0,1);
+               }
+
+                       // DAM integration
+               if ($this->task && $fileList && $this->extClassConf)    {
+                       $damFileList = array();
+                       foreach ($indexFileList as $file)       {
+                               $absFile = $dir.$file;
+                               $damFileList[md5($absFile)] = $absFile;
+                       }
+                       $this->checkExtObj();
+                       $this->storeFilesTodo($damFileList);
+                       $this->addParams['task'] = $this->task;
+                       $_GET['indexStart'] = 1;
+                       $this->pathInfo = $dir;
+                       $this->extObjHeader();
+                       $this->setIndexData();
+                       $this->extObjContent();
+               } elseif ($doIndexing)  {
+                       $this->task = t3lib_div::_GP('task');
+                       $this->addParams['task'] = $this->task;
+                       $this->checkExtObj();
+                       $this->extObjHeader();
+                       $this->setIndexData();
+                       $this->extObjContent();
+               }
+
+               if($unpacked && $this->extClassConf)    {
+                       $this->content .= $this->doc->divider(5);
+               }
+               $this->content .= '<a href="#" onClick="top.goToModule(top.currentModuleLoaded); return false;">'.$LANG->getLL('back').'</a>';
+       } // EOF: function moduleContent()
+
+
+
+       /**
+        * This method puts together all information required for DAM indexing of new (extracted) files
+        *
+        * @return      void
+        */
+       function setIndexData() {
+               $setup = array();
+               $setup['ruleConf'] = $this->getIndexData_ruleConf();
+               $setup['dataPreset'] = $this->getIndexData_fields('dataPreset');
+               $setup['dataPostset'] = $this->getIndexData_fields('dataPostset');
+               $GLOBALS['SOBE']->MOD_SETTINGS['tx_damindex_indexSetup'] = serialize($setup);
+               $this->extObj->processIndexSetup();
+       }
+
+       /**
+        * Setting up information required for DAM indexing of new (extracted) files
+        *
+        * @return      array           DAM indexing rules
+        */
+       function getIndexData_ruleConf()        {
+               $result = array();
+               $this->extObj->index->setDefaultSetup();
+               foreach ($this->extObj->index->ruleConf as $ruleName => $options)       {
+                       if ($ruleConf = $this->modTSconfig['properties']['dam.'][$this->task.'.']['ruleConf.'][$ruleName.'.'])  {
+                               foreach ($options as $key => $value)    {
+                                       if (isset($ruleConf[$key]))     {
+                                               $result[$ruleName][$key] = $ruleConf[$key];
+                                       }
+                               }
+                       }
+               }
+               return $result;
+       }
+
+       /**
+        * Setting up information required for DAM indexing of new (extracted) files
+        *
+        * @param       array           DAM sub configuration key
+        * @return      array           DAM indexing fields
+        */
+       function getIndexData_fields($subConf)  {
+               global $TCA;
+               $TSpreset = $this->modTSconfig['properties']['dam.'][$this->task.'.'][$subConf.'.'];
+               $result = array();
+               t3lib_div::loadTCA('tx_dam');
+               foreach ($TCA['tx_dam']['columns'] as $field => $conf)  {
+                       if (isset($TSpreset[$field]))   {
+                               $result[$field] = $TSpreset[$field];
+                       }
+               }
+               return $result;
+       }
+
+       /**
+        * Storing data required for DAM indexing in session
+        *
+        * @param       array           Files scheduled for DAM indexing
+        * @return      void
+        */
+       function storeFilesTodo($damFileList)   {
+               $newSettings = array(
+                       'tx_kbpackman_dam_filesTodo' => serialize($damFileList),
+               );
+               $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($GLOBALS['SOBE']->MOD_MENU, $newSettings, $GLOBALS['SOBE']->MCONF['name'], $GLOBALS['SOBE']->modMenu_type, $GLOBALS['SOBE']->modMenu_dontValidateList, $GLOBALS['SOBE']->modMenu_setDefaultList);
+       }
+
+       /**
+        * Generate output for display of extracted/archived files
+        *
+        * @param       string          Header which to prepend output
+        * @param       array           List of files which were processed
+        * @param       string          Parameter which will replace the "###PARAM1###" marker
+        * @param       boolean         When set the amount of data size reduction would get shown (only valid for zip files being created)
+        * @return      string          Generated output
+        */
+       function outputResult($header, $fileList, $param1 = '', $compProc = 0)  {
+               global $LANG;
+               $content = '';
+               $content .= str_replace('###PARAM1###', $param1, $header).':';
+               $content .= $this->doc->divider(5);
+               $reducedLabel = $GLOBALS['LANG']->getLL('reduced');
+               foreach ($fileList as $file) {
+                       if ($compProc)  {
+                               $parts = explode(' ', $file);
+                               $def = substr(trim(array_pop($parts)), 0, -1);
+                               array_pop($parts);
+                               $file = implode(' ', $parts);
+                               $file = basename($file).' <b>'.$def.' '.$reducedLabel.'</b>';
+                       }
+                       $content .= $file.'<br />'.chr(10);
+               }
+               $content .= $this->doc->divider(5);
+               return $content;
+       }
+
+
+       /**
+        * Returns if the file is in a valid location
+        *
+        * @return      bool            File in valid location
+        */
+       function checkValidLocation()   {
+               if (strpos($this->file, PATH_site.'fileadmin/') !== 0) {
+                       return false;
+               }
+               foreach ($GLOBALS['BE_USER']->groupData['filemounts'] as $key => $val) {
+                       if (strpos($this->file, $val['path']) === 0) {
+                               return true;
+                       }
+               }
+               return false;
+       } // EOF: function moduleContent()
+
+
+} // EOF: class tx_kbpackman_module extends t3lib_SCbase
+
+
+
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/kb_packman/cm1/index.php'])   {
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/kb_packman/cm1/index.php']);
+}
+
+
+
+
+// Make instance:
+$SOBE = t3lib_div::makeInstance('tx_kbpackman_module');
+$SOBE->init();
+
+
+$SOBE->main();
+$SOBE->printContent();
+
+?>
diff --git a/cm1/locallang.xml b/cm1/locallang.xml
new file mode 100755 (executable)
index 0000000..e658dc8
--- /dev/null
@@ -0,0 +1,286 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<T3locallang>
+    <meta type="array">
+        <description>Labels for the packman module</description>
+        <type>module</type>
+        <csh_table></csh_table>
+        <labelContext type="array">
+        </labelContext>
+    </meta>
+    <data type="array">
+        <languageKey index="default" type="array">
+            <label index="title">Archive Manager</label>
+            <label index="pack_head">Archive file/directory</label>
+            <label index="unpack_head">Extract file</label>
+            <label index="back">Back ...</label>
+            <label index="files_unpacked">The following files where extracted into the fileadmin</label>
+            <label index="files_packed">The follwing files were archived into the file &quot;###PARAM1###&quot;</label>
+            <label index="files_not_allowed">You are not an admin user and try to extract a file which contains not allowed file types (.php, etc). Just admins are allowed to extract files on which there are security restrictions !</label>
+            <label index="reduced">reduced</label>
+        </languageKey>
+        <languageKey index="dk" type="array">
+        </languageKey>
+        <languageKey index="de" type="array">
+            <label index="title">Extrahieren</label>
+            <label index="pack_head">Datei/Verzeichniss archivieren</label>
+            <label index="unpack_head">Extrahiere Datei</label>
+            <label index="back">Zurück ...</label>
+            <label index="files_unpacked">Die folgenden Dateien wurden im fileadmin extrahiert</label>
+            <label index="files_packed">Die folgenden Dateien wurden in die Datei &quot;###PARAM1###&quot; archiviert</label>
+            <label index="files_not_allowed">Sie sind kein Admin User und versuchen ein Datei zu extrahieren welche eine nicht erlaubte Endung hat (.php, etc.). Nur Admins dürfen Dateien mit Endungen extrahieren welche ein Sicherheitsrisiko darstellen könnten!</label>
+            <label index="reduced">verkleinert</label>
+        </languageKey>
+        <languageKey index="no" type="array">
+        </languageKey>
+        <languageKey index="it" type="array">
+        </languageKey>
+        <languageKey index="fr" type="array">
+        </languageKey>
+        <languageKey index="es" type="array">
+        </languageKey>
+        <languageKey index="nl" type="array">
+        </languageKey>
+        <languageKey index="cz" type="array">
+        </languageKey>
+        <languageKey index="pl" type="array">
+        </languageKey>
+        <languageKey index="si" type="array">
+        </languageKey>
+        <languageKey index="fi" type="array">
+        </languageKey>
+        <languageKey index="tr" type="array">
+        </languageKey>
+        <languageKey index="se" type="array">
+        </languageKey>
+        <languageKey index="pt" type="array">
+        </languageKey>
+        <languageKey index="ru" type="array">
+        </languageKey>
+        <languageKey index="ro" type="array">
+        </languageKey>
+        <languageKey index="ch" type="array">
+        </languageKey>
+        <languageKey index="sk" type="array">
+        </languageKey>
+        <languageKey index="lt" type="array">
+        </languageKey>
+        <languageKey index="is" type="array">
+        </languageKey>
+        <languageKey index="hr" type="array">
+        </languageKey>
+        <languageKey index="hu" type="array">
+        </languageKey>
+        <languageKey index="gl" type="array">
+        </languageKey>
+        <languageKey index="th" type="array">
+        </languageKey>
+        <languageKey index="gr" type="array">
+        </languageKey>
+        <languageKey index="hk" type="array">
+        </languageKey>
+        <languageKey index="eu" type="array">
+        </languageKey>
+        <languageKey index="bg" type="array">
+        </languageKey>
+        <languageKey index="br" type="array">
+        </languageKey>
+        <languageKey index="et" type="array">
+        </languageKey>
+        <languageKey index="ar" type="array">
+        </languageKey>
+        <languageKey index="he" type="array">
+        </languageKey>
+        <languageKey index="ua" type="array">
+        </languageKey>
+        <languageKey index="lv" type="array">
+        </languageKey>
+        <languageKey index="jp" type="array">
+        </languageKey>
+        <languageKey index="vn" type="array">
+        </languageKey>
+        <languageKey index="ca" type="array">
+        </languageKey>
+        <languageKey index="ba" type="array">
+        </languageKey>
+        <languageKey index="kr" type="array">
+        </languageKey>
+    </data>
+    <orig_hash type="array">
+        <languageKey index="default" type="array">
+            <label index="title" type="integer">219232407</label>
+            <label index="pack_head" type="integer">264942296</label>
+            <label index="unpack_head" type="integer">188484517</label>
+            <label index="back" type="integer">170818826</label>
+            <label index="files_unpacked" type="integer">208152877</label>
+            <label index="files_packed" type="integer">36403401</label>
+            <label index="files_not_allowed" type="integer">228432419</label>
+        </languageKey>
+        <languageKey index="dk" type="array">
+        </languageKey>
+        <languageKey index="de" type="array">
+            <label index="title" type="integer">219232407</label>
+            <label index="pack_head" type="integer">264942296</label>
+            <label index="unpack_head" type="integer">188484517</label>
+            <label index="back" type="integer">170818826</label>
+            <label index="files_unpacked" type="integer">208152877</label>
+            <label index="files_packed" type="integer">36403401</label>
+            <label index="files_not_allowed" type="integer">228432419</label>
+        </languageKey>
+        <languageKey index="no" type="array">
+        </languageKey>
+        <languageKey index="it" type="array">
+        </languageKey>
+        <languageKey index="fr" type="array">
+        </languageKey>
+        <languageKey index="es" type="array">
+        </languageKey>
+        <languageKey index="nl" type="array">
+        </languageKey>
+        <languageKey index="cz" type="array">
+        </languageKey>
+        <languageKey index="pl" type="array">
+        </languageKey>
+        <languageKey index="si" type="array">
+        </languageKey>
+        <languageKey index="fi" type="array">
+        </languageKey>
+        <languageKey index="tr" type="array">
+        </languageKey>
+        <languageKey index="se" type="array">
+        </languageKey>
+        <languageKey index="pt" type="array">
+        </languageKey>
+        <languageKey index="ru" type="array">
+        </languageKey>
+        <languageKey index="ro" type="array">
+        </languageKey>
+        <languageKey index="ch" type="array">
+        </languageKey>
+        <languageKey index="sk" type="array">
+        </languageKey>
+        <languageKey index="lt" type="array">
+        </languageKey>
+        <languageKey index="is" type="array">
+        </languageKey>
+        <languageKey index="hr" type="array">
+        </languageKey>
+        <languageKey index="hu" type="array">
+        </languageKey>
+        <languageKey index="gl" type="array">
+        </languageKey>
+        <languageKey index="th" type="array">
+        </languageKey>
+        <languageKey index="gr" type="array">
+        </languageKey>
+        <languageKey index="hk" type="array">
+        </languageKey>
+        <languageKey index="eu" type="array">
+        </languageKey>
+        <languageKey index="bg" type="array">
+        </languageKey>
+        <languageKey index="br" type="array">
+        </languageKey>
+        <languageKey index="et" type="array">
+        </languageKey>
+        <languageKey index="ar" type="array">
+        </languageKey>
+        <languageKey index="he" type="array">
+        </languageKey>
+        <languageKey index="ua" type="array">
+        </languageKey>
+        <languageKey index="lv" type="array">
+        </languageKey>
+        <languageKey index="jp" type="array">
+        </languageKey>
+        <languageKey index="vn" type="array">
+        </languageKey>
+        <languageKey index="ca" type="array">
+        </languageKey>
+        <languageKey index="ba" type="array">
+        </languageKey>
+        <languageKey index="kr" type="array">
+        </languageKey>
+    </orig_hash>
+    <orig_text type="array">
+        <languageKey index="default" type="array">
+        </languageKey>
+        <languageKey index="dk" type="array">
+        </languageKey>
+        <languageKey index="de" type="array">
+        </languageKey>
+        <languageKey index="no" type="array">
+        </languageKey>
+        <languageKey index="it" type="array">
+        </languageKey>
+        <languageKey index="fr" type="array">
+        </languageKey>
+        <languageKey index="es" type="array">
+        </languageKey>
+        <languageKey index="nl" type="array">
+        </languageKey>
+        <languageKey index="cz" type="array">
+        </languageKey>
+        <languageKey index="pl" type="array">
+        </languageKey>
+        <languageKey index="si" type="array">
+        </languageKey>
+        <languageKey index="fi" type="array">
+        </languageKey>
+        <languageKey index="tr" type="array">
+        </languageKey>
+        <languageKey index="se" type="array">
+        </languageKey>
+        <languageKey index="pt" type="array">
+        </languageKey>
+        <languageKey index="ru" type="array">
+        </languageKey>
+        <languageKey index="ro" type="array">
+        </languageKey>
+        <languageKey index="ch" type="array">
+        </languageKey>
+        <languageKey index="sk" type="array">
+        </languageKey>
+        <languageKey index="lt" type="array">
+        </languageKey>
+        <languageKey index="is" type="array">
+        </languageKey>
+        <languageKey index="hr" type="array">
+        </languageKey>
+        <languageKey index="hu" type="array">
+        </languageKey>
+        <languageKey index="gl" type="array">
+        </languageKey>
+        <languageKey index="th" type="array">
+        </languageKey>
+        <languageKey index="gr" type="array">
+        </languageKey>
+        <languageKey index="hk" type="array">
+        </languageKey>
+        <languageKey index="eu" type="array">
+        </languageKey>
+        <languageKey index="bg" type="array">
+        </languageKey>
+        <languageKey index="br" type="array">
+        </languageKey>
+        <languageKey index="et" type="array">
+        </languageKey>
+        <languageKey index="ar" type="array">
+        </languageKey>
+        <languageKey index="he" type="array">
+        </languageKey>
+        <languageKey index="ua" type="array">
+        </languageKey>
+        <languageKey index="lv" type="array">
+        </languageKey>
+        <languageKey index="jp" type="array">
+        </languageKey>
+        <languageKey index="vn" type="array">
+        </languageKey>
+        <languageKey index="ca" type="array">
+        </languageKey>
+        <languageKey index="ba" type="array">
+        </languageKey>
+        <languageKey index="kr" type="array">
+        </languageKey>
+    </orig_text>
+</T3locallang>
\ No newline at end of file
diff --git a/doc/.~lock.manual.sxw# b/doc/.~lock.manual.sxw#
new file mode 100755 (executable)
index 0000000..16c6a27
--- /dev/null
@@ -0,0 +1 @@
+Bernhard Kraft,kraftb,nitrogen,11.03.2010 12:32,file:///home/kraftb/.openoffice.org/3;
\ No newline at end of file
diff --git a/doc/manual.sxw b/doc/manual.sxw
new file mode 100755 (executable)
index 0000000..a718e67
Binary files /dev/null and b/doc/manual.sxw differ
diff --git a/ext_autoload.php b/ext_autoload.php
new file mode 100755 (executable)
index 0000000..938ad1a
--- /dev/null
@@ -0,0 +1,9 @@
+<?php
+
+$extensionPath = t3lib_extMgm::extPath('kb_packman');
+
+return array(
+       'tx_kbpackman_cm1' => $extensionPath . 'class.tx_kbpackman_cm1.php',
+       'tx_kbpackman' => $extensionPath . 'class.tx_kbpackman.php',
+);
+?>
\ No newline at end of file
diff --git a/ext_conf_template.txt b/ext_conf_template.txt
new file mode 100755 (executable)
index 0000000..4425933
--- /dev/null
@@ -0,0 +1,13 @@
+
+# cat=basic; type=string; label=Compress directory target-folder: The folder into which compressed directories will be put
+dirTarget = ./
+
+# cat=basic; type=string; label=Compress file target-folder: The folder into which compressed file(s) will be put
+fileTarget = ./
+
+# cat=basic; type=options[zip,rar,tgz,tbz2]; label=Target archive type: The type of archive which should get created when files get archived
+targetExt = zip
+
+# cat=basic; type=boolean; label=DAM support: When set and DAM (+dam_index) is installed newly extracted files get indexed automatically
+DAMsupport = 1
+
diff --git a/ext_emconf.php b/ext_emconf.php
new file mode 100755 (executable)
index 0000000..751e661
--- /dev/null
@@ -0,0 +1,49 @@
+<?php
+
+########################################################################
+# Extension Manager/Repository config file for ext "kb_packman".
+#
+# Auto generated 11-03-2010 10:08
+#
+# Manual updates:
+# Only the data in the array - everything else is removed by next
+# writing. "version" and "dependencies" must not be touched!
+########################################################################
+
+$EM_CONF[$_EXTKEY] = array(
+       'title' => 'Packman',
+       'description' => 'Unzips or a zips files and folders (also tar.gz/tar.bz2) file in the fileadmin with a single click.',
+       'category' => 'be',
+       'shy' => 0,
+       'version' => '0.2.2',
+       'dependencies' => '',
+       'conflicts' => '',
+       'priority' => '',
+       'loadOrder' => '',
+       'module' => 'cm1',
+       'state' => 'stable',
+       'uploadfolder' => 0,
+       'createDirs' => '',
+       'modify_tables' => '',
+       'clearcacheonload' => 0,
+       'lockType' => '',
+       'author' => 'Bernhard Kraft',
+       'author_email' => 'kraftb@kraftb.at',
+       'author_company' => 'think-open',
+       'CGLcompliance' => '',
+       'CGLcompliance_note' => '',
+       'constraints' => array(
+               'depends' => array(
+                       'typo3' => '3.5.0-0.0.0',
+                       'php' => '3.0.0-0.0.0',
+                       'cms' => '',
+               ),
+               'conflicts' => array(
+               ),
+               'suggests' => array(
+               ),
+       ),
+       '_md5_values_when_last_written' => 'a:19:{s:6:"README";s:4:"67e8";s:22:"class.tx_kbpackman.php";s:4:"6e74";s:26:"class.tx_kbpackman_cm1.php";s:4:"645c";s:26:"class.tx_kbpackman_dam.php";s:4:"bf9b";s:21:"ext_conf_template.txt";s:4:"cfbf";s:12:"ext_icon.gif";s:4:"bc6e";s:16:"ext_icon_alt.gif";s:4:"d017";s:17:"ext_localconf.php";s:4:"2595";s:14:"ext_tables.php";s:4:"75ca";s:13:"locallang.php";s:4:"cdb0";s:13:"cm1/clear.gif";s:4:"cc11";s:28:"cm1/cm_icon_compress_dir.gif";s:4:"bd7d";s:29:"cm1/cm_icon_compress_file.gif";s:4:"edb6";s:22:"cm1/cm_icon_unpack.gif";s:4:"8074";s:32:"cm1/cm_icon_unpack_overwrite.gif";s:4:"8074";s:12:"cm1/conf.php";s:4:"b710";s:13:"cm1/index.php";s:4:"63c6";s:17:"cm1/locallang.php";s:4:"6693";s:14:"doc/manual.sxw";s:4:"4159";}',
+);
+
+?>
\ No newline at end of file
diff --git a/ext_icon.gif b/ext_icon.gif
new file mode 100755 (executable)
index 0000000..86e37a2
Binary files /dev/null and b/ext_icon.gif differ
diff --git a/ext_icon_alt.gif b/ext_icon_alt.gif
new file mode 100755 (executable)
index 0000000..d87576c
Binary files /dev/null and b/ext_icon_alt.gif differ
diff --git a/ext_localconf.php b/ext_localconf.php
new file mode 100755 (executable)
index 0000000..7d48441
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+if (!defined ("TYPO3_MODE"))   die ("Access denied.");
+
+$TYPO3_CONF_VARS["BE"]["unzip"]["list-zip"]["pre_lines"] = 3;
+$TYPO3_CONF_VARS["BE"]["unzip"]["list-zip"]["post_lines"] = 2;
+$TYPO3_CONF_VARS["BE"]["unzip"]["list-zip"]["split_char"] = " ";
+$TYPO3_CONF_VARS["BE"]["unzip"]["list-zip"]["file_pos"] = 3;
+
+$TYPO3_CONF_VARS["BE"]["unzip"]["unzip"]["pre_lines"] = 1;
+$TYPO3_CONF_VARS["BE"]["unzip"]["unzip"]["post_lines"] = 0;
+$TYPO3_CONF_VARS["BE"]["unzip"]["unzip"]["split_char"] = ":";
+$TYPO3_CONF_VARS["BE"]["unzip"]["unzip"]["file_pos"] = 1;
+
+$TYPO3_CONF_VARS["BE"]["unzip"]["unrar"]["pre_lines"] = -1;
+$TYPO3_CONF_VARS["BE"]["unzip"]["unrar"]["post_lines"] = 0;
+$TYPO3_CONF_VARS["BE"]["unzip"]["unrar"]["split_char"] = " ";
+$TYPO3_CONF_VARS["BE"]["unzip"]["unrar"]["file_pos"] = 1;
+
+$TYPO3_CONF_VARS["BE"]["unzip"]["rar"]["pre_lines"] = -1;
+$TYPO3_CONF_VARS["BE"]["unzip"]["rar"]["post_lines"] = 0;
+$TYPO3_CONF_VARS["BE"]["unzip"]["rar"]["split_char"] = " ";
+$TYPO3_CONF_VARS["BE"]["unzip"]["rar"]["file_pos"] = 1;
+
+$TYPO3_CONF_VARS["BE"]["unzip"]["zip"]["pre_lines"] = 0;
+$TYPO3_CONF_VARS["BE"]["unzip"]["zip"]["split_char"] = ":";
+$TYPO3_CONF_VARS["BE"]["unzip"]["zip"]["file_pos"] = 1;
+
+$_EXTCONF = unserialize($_EXTCONF);    // unserializing the configuration so we can use it here
+$GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$_EXTKEY]['dirTarget'] = trim($_EXTCONF['dirTarget']);
+$GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$_EXTKEY]['fileTarget'] = trim($_EXTCONF['fileTarget']);
+$GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$_EXTKEY]['targetExt'] = trim($_EXTCONF['targetExt']);
+$GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$_EXTKEY]['DAMsupport'] = trim($_EXTCONF['DAMsupport']);
+
+
+?>
diff --git a/ext_tables.php b/ext_tables.php
new file mode 100755 (executable)
index 0000000..be2b491
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+if (!defined ('TYPO3_MODE'))   die ('Access denied.');
+
+require_once(t3lib_extMgm::extPath($_EXTKEY).'class.tx_kbpackman_cm1.php');
+
+if (TYPO3_MODE=='BE')  {
+       $GLOBALS['TBE_MODULES_EXT']['xMOD_alt_clickmenu']['extendCMclasses'][]=array(
+               'name' => 'tx_kbpackman_cm1',
+               'path' => t3lib_extMgm::extPath($_EXTKEY).'class.tx_kbpackman_cm1.php'
+       );
+
+       if ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$_EXTKEY]['DAMsupport'] && t3lib_extMgm::isLoaded('dam') && t3lib_extMgm::isLoaded('dam_index') )    {
+               t3lib_extMgm::insertModuleFunction(
+                       'tx_kbpackman',
+                       'tx_kbpackman_dam',
+                       t3lib_extMgm::extPath($_EXTKEY).'class.tx_kbpackman_dam.php',
+                       'LLL:EXT:dam_index/modfunc_index/locallang.xml:tx_damindex_index.title'
+               );
+       }
+
+}
+?>
diff --git a/locallang.xml b/locallang.xml
new file mode 100755 (executable)
index 0000000..92ca43a
--- /dev/null
@@ -0,0 +1,268 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<T3locallang>
+    <meta type="array">
+        <description></description>
+        <type>module</type>
+        <csh_table></csh_table>
+        <labelContext type="array">
+        </labelContext>
+    </meta>
+    <data type="array">
+        <languageKey index="default" type="array">
+            <label index="cm1_title">Extract archive</label>
+            <label index="cm1_title_overwrite">Extract archive (Overwrite existing files)</label>
+            <label index="cm1_title_compress">Create archive</label>
+        </languageKey>
+        <languageKey index="dk" type="array">
+        </languageKey>
+        <languageKey index="de" type="array">
+            <label index="cm1_title">Archiv extrahieren</label>
+            <label index="cm1_title_overwrite">Archiv extrahieren (Bestehende Dateien überschreiben)</label>
+            <label index="cm1_title_compress">Archiv erzeugen</label>
+        </languageKey>
+        <languageKey index="no" type="array">
+        </languageKey>
+        <languageKey index="it" type="array">
+        </languageKey>
+        <languageKey index="fr" type="array">
+        </languageKey>
+        <languageKey index="es" type="array">
+        </languageKey>
+        <languageKey index="nl" type="array">
+        </languageKey>
+        <languageKey index="cz" type="array">
+        </languageKey>
+        <languageKey index="pl" type="array">
+        </languageKey>
+        <languageKey index="si" type="array">
+        </languageKey>
+        <languageKey index="fi" type="array">
+        </languageKey>
+        <languageKey index="tr" type="array">
+        </languageKey>
+        <languageKey index="se" type="array">
+        </languageKey>
+        <languageKey index="pt" type="array">
+        </languageKey>
+        <languageKey index="ru" type="array">
+        </languageKey>
+        <languageKey index="ro" type="array">
+        </languageKey>
+        <languageKey index="ch" type="array">
+        </languageKey>
+        <languageKey index="sk" type="array">
+        </languageKey>
+        <languageKey index="lt" type="array">
+        </languageKey>
+        <languageKey index="is" type="array">
+        </languageKey>
+        <languageKey index="hr" type="array">
+        </languageKey>
+        <languageKey index="hu" type="array">
+        </languageKey>
+        <languageKey index="gl" type="array">
+        </languageKey>
+        <languageKey index="th" type="array">
+        </languageKey>
+        <languageKey index="gr" type="array">
+        </languageKey>
+        <languageKey index="hk" type="array">
+        </languageKey>
+        <languageKey index="eu" type="array">
+        </languageKey>
+        <languageKey index="bg" type="array">
+        </languageKey>
+        <languageKey index="br" type="array">
+        </languageKey>
+        <languageKey index="et" type="array">
+        </languageKey>
+        <languageKey index="ar" type="array">
+        </languageKey>
+        <languageKey index="he" type="array">
+        </languageKey>
+        <languageKey index="ua" type="array">
+        </languageKey>
+        <languageKey index="lv" type="array">
+        </languageKey>
+        <languageKey index="jp" type="array">
+        </languageKey>
+        <languageKey index="vn" type="array">
+        </languageKey>
+        <languageKey index="ca" type="array">
+        </languageKey>
+        <languageKey index="ba" type="array">
+        </languageKey>
+        <languageKey index="kr" type="array">
+        </languageKey>
+    </data>
+    <orig_hash type="array">
+        <languageKey index="default" type="array">
+            <label index="cm1_title" type="integer">31401173</label>
+            <label index="cm1_title_overwrite" type="integer">195915252</label>
+            <label index="cm1_title_compress" type="integer">264839858</label>
+        </languageKey>
+        <languageKey index="dk" type="array">
+        </languageKey>
+        <languageKey index="de" type="array">
+            <label index="cm1_title" type="integer">31401173</label>
+            <label index="cm1_title_overwrite" type="integer">195915252</label>
+            <label index="cm1_title_compress" type="integer">264839858</label>
+        </languageKey>
+        <languageKey index="no" type="array">
+        </languageKey>
+        <languageKey index="it" type="array">
+        </languageKey>
+        <languageKey index="fr" type="array">
+        </languageKey>
+        <languageKey index="es" type="array">
+        </languageKey>
+        <languageKey index="nl" type="array">
+        </languageKey>
+        <languageKey index="cz" type="array">
+        </languageKey>
+        <languageKey index="pl" type="array">
+        </languageKey>
+        <languageKey index="si" type="array">
+        </languageKey>
+        <languageKey index="fi" type="array">
+        </languageKey>
+        <languageKey index="tr" type="array">
+        </languageKey>
+        <languageKey index="se" type="array">
+        </languageKey>
+        <languageKey index="pt" type="array">
+        </languageKey>
+        <languageKey index="ru" type="array">
+        </languageKey>
+        <languageKey index="ro" type="array">
+        </languageKey>
+        <languageKey index="ch" type="array">
+        </languageKey>
+        <languageKey index="sk" type="array">
+        </languageKey>
+        <languageKey index="lt" type="array">
+        </languageKey>
+        <languageKey index="is" type="array">
+        </languageKey>
+        <languageKey index="hr" type="array">
+        </languageKey>
+        <languageKey index="hu" type="array">
+        </languageKey>
+        <languageKey index="gl" type="array">
+        </languageKey>
+        <languageKey index="th" type="array">
+        </languageKey>
+        <languageKey index="gr" type="array">
+        </languageKey>
+        <languageKey index="hk" type="array">
+        </languageKey>
+        <languageKey index="eu" type="array">
+        </languageKey>
+        <languageKey index="bg" type="array">
+        </languageKey>
+        <languageKey index="br" type="array">
+        </languageKey>
+        <languageKey index="et" type="array">
+        </languageKey>
+        <languageKey index="ar" type="array">
+        </languageKey>
+        <languageKey index="he" type="array">
+        </languageKey>
+        <languageKey index="ua" type="array">
+        </languageKey>
+        <languageKey index="lv" type="array">
+        </languageKey>
+        <languageKey index="jp" type="array">
+        </languageKey>
+        <languageKey index="vn" type="array">
+        </languageKey>
+        <languageKey index="ca" type="array">
+        </languageKey>
+        <languageKey index="ba" type="array">
+        </languageKey>
+        <languageKey index="kr" type="array">
+        </languageKey>
+    </orig_hash>
+    <orig_text type="array">
+        <languageKey index="default" type="array">
+        </languageKey>
+        <languageKey index="dk" type="array">
+        </languageKey>
+        <languageKey index="de" type="array">
+        </languageKey>
+        <languageKey index="no" type="array">
+        </languageKey>
+        <languageKey index="it" type="array">
+        </languageKey>
+        <languageKey index="fr" type="array">
+        </languageKey>
+        <languageKey index="es" type="array">
+        </languageKey>
+        <languageKey index="nl" type="array">
+        </languageKey>
+        <languageKey index="cz" type="array">
+        </languageKey>
+        <languageKey index="pl" type="array">
+        </languageKey>
+        <languageKey index="si" type="array">
+        </languageKey>
+        <languageKey index="fi" type="array">
+        </languageKey>
+        <languageKey index="tr" type="array">
+        </languageKey>
+        <languageKey index="se" type="array">
+        </languageKey>
+        <languageKey index="pt" type="array">
+        </languageKey>
+        <languageKey index="ru" type="array">
+        </languageKey>
+        <languageKey index="ro" type="array">
+        </languageKey>
+        <languageKey index="ch" type="array">
+        </languageKey>
+        <languageKey index="sk" type="array">
+        </languageKey>
+        <languageKey index="lt" type="array">
+        </languageKey>
+        <languageKey index="is" type="array">
+        </languageKey>
+        <languageKey index="hr" type="array">
+        </languageKey>
+        <languageKey index="hu" type="array">
+        </languageKey>
+        <languageKey index="gl" type="array">
+        </languageKey>
+        <languageKey index="th" type="array">
+        </languageKey>
+        <languageKey index="gr" type="array">
+        </languageKey>
+        <languageKey index="hk" type="array">
+        </languageKey>
+        <languageKey index="eu" type="array">
+        </languageKey>
+        <languageKey index="bg" type="array">
+        </languageKey>
+        <languageKey index="br" type="array">
+        </languageKey>
+        <languageKey index="et" type="array">
+        </languageKey>
+        <languageKey index="ar" type="array">
+        </languageKey>
+        <languageKey index="he" type="array">
+        </languageKey>
+        <languageKey index="ua" type="array">
+        </languageKey>
+        <languageKey index="lv" type="array">
+        </languageKey>
+        <languageKey index="jp" type="array">
+        </languageKey>
+        <languageKey index="vn" type="array">
+        </languageKey>
+        <languageKey index="ca" type="array">
+        </languageKey>
+        <languageKey index="ba" type="array">
+        </languageKey>
+        <languageKey index="kr" type="array">
+        </languageKey>
+    </orig_text>
+</T3locallang>
\ No newline at end of file