Commit 4d96bffc4a848b411fc7c7768e99147f0b51f9c6

Authored by kevin_fourie
1 parent c9ae7e26

Reverted KTS-1055

"Bulk export does not work with national characters."
IConv is not currently in the stack so this fix will not work. Should be in 3.4.

Reviewed By: Conrad


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/trunk@6297 c91229c3-7414-0410-bfa2-8a42b809f60b
config/config.ini
... ... @@ -192,11 +192,6 @@ unzip = unzip
192 192 ; binary is not given
193 193 zip = zip
194 194  
195   -; encoding to use in bulk export plugin
196   -; default is set to UTF-8
197   -; encoding = cp1252
198   -encoding = default
199   -
200 195 [indexer]
201 196 ; indexer commands - will use execSearchPath to find if the path to the
202 197 ; binary is not given
... ...
plugins/ktstandard/KTBulkExportPlugin.php
... ... @@ -50,52 +50,12 @@ class KTBulkExportAction extends KTFolderAction {
50 50 var $sName = 'ktstandard.bulkexport.action';
51 51 var $sPermissionName = "ktcore.permissions.folder_details";
52 52 var $_sShowPermission = "ktcore.permissions.folder_details";
53   - var $sOutputEncoding = 'UTF-8';
54   -
55   - function _checkConvertEncoding() {
56   - if(!function_exists("iconv")) {
57   - $this->addErrorMessage(_kt('IConv PHP extension not installed. Bulk export could not handle output filename encoding conversion !'));
58   - return false;
59   - }
60   - $oKTConfig = KTConfig::getSingleton();
61   - $this->sOutputEncoding = $oKTConfig->get('export/encoding', 'UTF-8');
62   -
63   - // Test the specified encoding
64   - if(iconv("UTF-8", $this->sOutputEncoding, "") === FALSE) {
65   - $this->addErrorMessage(_kt('Specified output encoding for bulk export does not exists !'));
66   - return false;
67   - }
68   - return true;
69   - }
70   -
71   - /**
72   - * Convert encoding to defined character encoding
73   - *
74   - * @param string the string to convert
75   - * @param boolean encode(true) or decode(false) string
76   - * @return string the encoded string
77   - */
78   - function _convertEncoding($sMystring, $bEncode) {
79   - if (strcasecmp($this->sOutputEncoding, "UTF-8") === 0) {
80   - return $sMystring;
81   - }
82   - if ($bEncode) {
83   - return iconv("UTF-8", $this->sOutputEncoding, $sMystring);
84   - } else {
85   - return iconv($this->sOutputEncoding, "UTF-8", $sMystring);
86   - }
87   - }
88 53  
89 54 function getDisplayName() {
90 55 return _kt('Bulk Export');
91 56 }
92 57  
93 58 function do_main() {
94   - if(!$this->_checkConvertEncoding()) {
95   - redirect(KTBrowseUtil::getUrlForFolder($oFolder));
96   - exit(0);
97   - }
98   -
99 59 $oStorage =& KTStorageManagerUtil::getSingleton();
100 60 $aQuery = $this->buildQuery();
101 61 $this->oValidator->notError($aQuery);
... ... @@ -141,8 +101,7 @@ class KTBulkExportAction extends KTFolderAction {
141 101  
142 102 $sParentFolder = sprintf('%s/%s', $sTmpPath, $oDocument->getFullPath());
143 103 $newDir = $this->sTmpPath;
144   - $sFullPath = $this->_convertEncoding($oDocument->getFullPath(), true);
145   - foreach (split('/', $sFullPath) as $dirPart) {
  104 + foreach (split('/', $oDocument->getFullPath()) as $dirPart) {
146 105 $newDir = sprintf("%s/%s", $newDir, $dirPart);
147 106 if (!file_exists($newDir)) {
148 107 mkdir($newDir, 0700);
... ... @@ -150,11 +109,9 @@ class KTBulkExportAction extends KTFolderAction {
150 109 }
151 110 $sOrigFile = $oStorage->temporaryFile($oDocument);
152 111 $sFilename = sprintf("%s/%s", $sParentFolder, $oDocument->getFileName());
153   - $sFilename = $this->_convertEncoding($sFilename, true);
154 112 copy($sOrigFile, $sFilename);
155 113 $sPath = sprintf("%s/%s", $oDocument->getFullPath(), $oDocument->getFileName());
156 114 $sPath = str_replace($aReplaceKeys, $aReplaceValues, $sPath);
157   - $sPath = $this->_convertEncoding($sPath, true);
158 115 $aPaths[] = $sPath;
159 116 }
160 117 $sManifest = sprintf("%s/%s", $this->sTmpPath, "MANIFEST");
... ... @@ -189,7 +146,7 @@ class KTBulkExportAction extends KTFolderAction {
189 146 }
190 147 $contents = fread($fh, 4096);
191 148 if ($contents) {
192   - print nl2br($this->_convertEncoding($contents, false));
  149 + print nl2br($contents);
193 150 }
194 151 $i++;
195 152 }
... ...