@@ -24,8 +24,8 @@ class UploadController extends AppController
24
24
*/
25
25
function init ()
26
26
{
27
- $ maxFile = str_replace (" M " , "" , ini_get ('upload_max_filesize ' ));
28
- $ maxPost = str_replace (" M " , "" , ini_get ('post_max_size ' ));
27
+ $ maxFile = str_replace (' M ' , '' , ini_get ('upload_max_filesize ' ));
28
+ $ maxPost = str_replace (' M ' , '' , ini_get ('post_max_size ' ));
29
29
if ($ maxFile < $ maxPost )
30
30
{
31
31
$ this ->view ->maxSizeFile = $ maxFile * 1024 * 1024 ;
@@ -62,11 +62,11 @@ public function simpleuploadAction()
62
62
{
63
63
if (!$ this ->logged )
64
64
{
65
- throw new Zend_Exception (" You have to be logged in to do that " );
65
+ throw new Zend_Exception (' You have to be logged in to do that ' );
66
66
}
67
67
if (!$ this ->getRequest ()->isXmlHttpRequest () && !$ this ->isTestingEnv ())
68
68
{
69
- throw new Zend_Exception (" Error, should be an ajax action. " );
69
+ throw new Zend_Exception (' Error, should be an ajax action. ' );
70
70
}
71
71
$ this ->disableLayout ();
72
72
$ this ->view ->form = $ this ->getFormAsArray ($ this ->Form ->Upload ->createUploadLinkForm ());
@@ -94,23 +94,23 @@ public function revisionAction()
94
94
{
95
95
if (!$ this ->logged )
96
96
{
97
- throw new Zend_Exception (" You have to be logged in to do that " );
97
+ throw new Zend_Exception (' You have to be logged in to do that ' );
98
98
}
99
99
if (!$ this ->getRequest ()->isXmlHttpRequest () && !$ this ->isTestingEnv ())
100
100
{
101
- throw new Zend_Exception (" Error, should be an ajax action. " );
101
+ throw new Zend_Exception (' Error, should be an ajax action. ' );
102
102
}
103
103
$ this ->disableLayout ();
104
104
$ itemId = $ this ->_getParam ('itemId ' );
105
105
$ item = $ this ->Item ->load ($ itemId );
106
106
107
107
if ($ item == false )
108
108
{
109
- throw new Zend_Exception (" Unable to load item. " );
109
+ throw new Zend_Exception (' Unable to load item. ' );
110
110
}
111
111
if (!$ this ->Item ->policyCheck ($ item , $ this ->userSession ->Dao , MIDAS_POLICY_WRITE ))
112
112
{
113
- throw new Zend_Exception (" Error policies. " );
113
+ throw new Zend_Exception (' Error policies. ' );
114
114
}
115
115
$ this ->view ->item = $ item ;
116
116
$ itemRevision = $ this ->Item ->getLastRevision ($ item );
@@ -123,20 +123,20 @@ public function savelinkAction()
123
123
{
124
124
if (!$ this ->logged )
125
125
{
126
- throw new Zend_Exception (" You have to be logged in to do that " );
126
+ throw new Zend_Exception (' You have to be logged in to do that ' );
127
127
}
128
128
if (!$ this ->getRequest ()->isXmlHttpRequest () && !$ this ->isTestingEnv ())
129
129
{
130
- throw new Zend_Exception (" Error, should be an ajax action. " );
130
+ throw new Zend_Exception (' Error, should be an ajax action. ' );
131
131
}
132
132
133
133
$ this ->disableLayout ();
134
134
$ this ->disableView ();
135
- $ parent = $ this ->_getParam (" parent " );
136
- $ name = $ this ->_getParam (" name " );
137
- $ url = $ this ->_getParam (" url " );
138
- $ parent = $ this ->_getParam (" parent " );
139
- $ license = $ this ->_getParam (" license " );
135
+ $ parent = $ this ->_getParam (' parent ' );
136
+ $ name = $ this ->_getParam (' name ' );
137
+ $ url = $ this ->_getParam (' url ' );
138
+ $ parent = $ this ->_getParam (' parent ' );
139
+ $ license = $ this ->_getParam (' license ' );
140
140
if (!empty ($ url ) && !empty ($ name ))
141
141
{
142
142
$ item = $ this ->Component ->Upload ->createLinkItem ($ this ->userSession ->Dao , $ name , $ url , $ parent );
@@ -149,14 +149,14 @@ public function javauploadAction()
149
149
{
150
150
if (!$ this ->logged )
151
151
{
152
- throw new Zend_Exception (" You have to be logged in to do that " );
152
+ throw new Zend_Exception (' You have to be logged in to do that ' );
153
153
}
154
154
if (!$ this ->getRequest ()->isXmlHttpRequest ())
155
155
{
156
- throw new Zend_Exception (" Error, should be an ajax action. " );
156
+ throw new Zend_Exception (' Error, should be an ajax action. ' );
157
157
}
158
158
$ this ->_helper ->layout ->disableLayout ();
159
- $ this ->view ->protocol = " http " ;
159
+ $ this ->view ->protocol = ' http ' ;
160
160
$ this ->view ->host = empty ($ _SERVER ['HTTP_X_FORWARDED_HOST ' ]) ? $ _SERVER ['HTTP_HOST ' ] : $ _SERVER ['HTTP_X_FORWARDED_HOST ' ];
161
161
$ this ->view ->selectedLicense = Zend_Registry::get ('configGlobal ' )->defaultlicense ;
162
162
@@ -184,7 +184,7 @@ function gethttpuploadoffsetAction()
184
184
$ this ->Component ->Httpupload ->get_http_upload_offset ($ params );
185
185
} //end get_http_upload_offset
186
186
187
- /** java upload function, didn 't check what it does :-) */
187
+ /** java upload function, didn't check what it does :-) */
188
188
function gethttpuploaduniqueidentifierAction ()
189
189
{
190
190
$ this ->disableLayout ();
@@ -200,7 +200,7 @@ function processjavauploadAction()
200
200
$ params = $ this ->_getAllParams ();
201
201
if (!$ this ->logged )
202
202
{
203
- throw new Zend_Exception (" You have to be logged in to do that " );
203
+ throw new Zend_Exception (' You have to be logged in to do that ' );
204
204
}
205
205
$ this ->disableLayout ();
206
206
$ this ->disableView ();
@@ -237,7 +237,7 @@ public function saveuploadedAction()
237
237
{
238
238
if (!$ this ->logged )
239
239
{
240
- throw new Zend_Exception (" You have to be logged in to do that " );
240
+ throw new Zend_Exception (' You have to be logged in to do that ' );
241
241
}
242
242
243
243
$ this ->disableLayout ();
@@ -252,23 +252,24 @@ public function saveuploadedAction()
252
252
}
253
253
else
254
254
{
255
+ // bugfix: We added an adapter class (see issue 324) under Zend/File/Transfer/Adapter
255
256
ob_start ();
256
- $ upload = new Zend_File_Transfer ();
257
+ $ upload = new Zend_File_Transfer (' HttpFixed ' );
257
258
$ upload ->receive ();
258
259
$ path = $ upload ->getFileName ();
259
260
$ file_size = filesize ($ path );
260
261
$ filename = $ upload ->getFilename (null , false );
261
262
ob_end_clean ();
262
263
}
263
264
264
- $ parent = $ this ->_getParam (" parent " );
265
- $ license = $ this ->_getParam (" license " );
265
+ $ parent = $ this ->_getParam (' parent ' );
266
+ $ license = $ this ->_getParam (' license ' );
266
267
if (!empty ($ path ) && file_exists ($ path ) && $ file_size > 0 )
267
268
{
268
269
$ tmp = explode ('- ' , $ parent );
269
270
if (count ($ tmp ) == 2 ) //means we upload a new revision
270
271
{
271
- $ changes = $ this ->_getParam (" changes " );
272
+ $ changes = $ this ->_getParam (' changes ' );
272
273
$ this ->Component ->Upload ->createNewRevision ($ this ->userSession ->Dao , $ filename , $ path , $ tmp , $ changes , $ license );
273
274
}
274
275
else
@@ -283,4 +284,4 @@ public function saveuploadedAction()
283
284
echo json_encode ($ info );
284
285
}
285
286
}//end saveuploaded
286
- }//end class
287
+ }//end class
0 commit comments