Cheetah
ChWsbFilesUploader.php
Go to the documentation of this file.
1 <?php
2 
8 require_once(CH_DIRECTORY_PATH_CLASSES . 'ChWsbTemplate.php');
9 
10 define('CH_WSB_UPLOADER_EP_PREFIX', 'extra_param_');
11 
13 {
17  var $_aExtras;
18 
20  var $iMaxFilesize; //max accepting filesize (in bytes)
21  var $sAcceptMimeType = '*'; // accept file mime type for html5 uploader, filter files by this type when choosing files from the filesystem
22  var $bImageAutoRotate = 0; // autorotate image for html5 uploader
23 
24  var $sUploadTypeNC; // Common
25  var $sUploadTypeLC; // common
26 
27  var $sTempFilename; // uploaded real filename, used as temp name
28 
29  var $oModule;
30 
31  // constructor
32  function __construct($sUploadTypeNC = 'Common')
33  {
34  parent::__construct();
35 
36  $this->sTempFilename = '';
37 
38  $this->sUploadTypeNC = $sUploadTypeNC;
39  $this->sUploadTypeLC = strtolower($this->sUploadTypeNC);
40 
41  $this->_iOwnerId = $this->_getAuthorId();
42 
43  $this->_sJsPostObject = 'o' . $this->sUploadTypeNC . 'Upload';
44  $this->sSendFileInfoFormCaption = '';
45 
46  $GLOBALS['oSysTemplate']->addJsTranslation(array(
47  '_ch_' . $this->sUploadTypeLC . 's_val_title_err',
48  '_ch_' . $this->sUploadTypeLC . 's_val_descr_err'
49  ));
50 
51  //--- Get Extras ---//
52  $this->_aExtras = array();
53  if (!empty($_POST)) {
54  $this->_aExtras = $this->_getExtraParams($_POST);
55  }
56 
57  $this->iMaxFilesize = min(return_bytes(ini_get('upload_max_filesize')),
58  return_bytes(ini_get('post_max_size'))); //max allowed from php.ini
59  }
60 
61  function _addHidden($sPostType = "photo", $sContentType = "upload", $sAction = "post", $iIndex = 1)
62  {
63  $aResult = array(
64  'UploadOwnerId' => array(
65  'type' => 'hidden',
66  'name' => 'UploadOwnerId',
67  'value' => $this->_iOwnerId,
68  ),
69  'UploadPostAction' => array(
70  'type' => 'hidden',
71  'name' => 'UploadPostAction',
72  'value' => $sAction,
73  ),
74  'UploadPostType' => array(
75  'type' => 'hidden',
76  'name' => 'UploadPostType',
77  'value' => $sPostType,
78  ),
79  'UploadContentType' => array(
80  'type' => 'hidden',
81  'name' => 'UploadContentType',
82  'value' => $sContentType,
83  ),
84  'index' => array(
85  'type' => 'hidden',
86  'name' => 'index',
87  'value' => $iIndex,
88  ),
89  );
90 
91  foreach ($this->_aExtras as $sKey => $mixedValue) {
92  $aResult[CH_WSB_UPLOADER_EP_PREFIX . $sKey] = array(
93  'type' => 'hidden',
94  'name' => CH_WSB_UPLOADER_EP_PREFIX . $sKey,
95  'value' => $mixedValue
96  );
97  }
98 
99  return $aResult;
100  }
101 
102  function _getAuthorId()
103  {
104  return getLoggedId();
105  }
106 
108  {
109  return !isMember() ? '' : $_COOKIE['memberPassword'];
110  }
111 
112  function _getExtraParams(&$aRequest)
113  {
114  $aParams = array();
115  foreach ($aRequest as $sKey => $sValue) {
116  if (strpos($sKey, CH_WSB_UPLOADER_EP_PREFIX) !== false) {
117  $aParams[str_replace(CH_WSB_UPLOADER_EP_PREFIX, '', $sKey)] = $sValue;
118  }
119  }
120 
121  return $aParams;
122  }
123 
124  function _updateExtraParams($aExtra, $iFileId, $iAuthorId)
125  {
126  $aFile = $this->oModule->_oDb->getFileInfo(array('fileId' => $iFileId));
127  if (empty($aFile)) {
128  return $aExtra;
129  }
130 
131  $oAlbums = new ChWsbAlbums('ch_' . $this->sUploadTypeLC . 's', $iAuthorId);
132  $aAlbum = $oAlbums->getAlbumInfo(array('fileId' => $aFile['albumId'], 'owner' => $iAuthorId));
133  if (empty($aAlbum)) {
134  return $aExtra;
135  }
136 
137  $aExtra['privacy_view'] = $aAlbum['AllowAlbumView'];
138  if (!isset($aExtra['album'])) {
139  $aExtra['album'] = $aAlbum['Uri'];
140  }
141 
142  return $aExtra;
143  }
144 
145  /***************************************************************************
146  ****************************Semi-common functions****************************
147  ****************************************************************************/
148  function _GenMainAddCommonForm($aExtras = array(), $aUploaders = array())
149  {
150  $this->_aExtras = $aExtras;
151  $sMode = isset($_GET['mode']) ? strip_tags($_GET['mode']) : $this->_aExtras['mode'];
152  unset($this->_aExtras['mode']);
153 
154  $aTxt = array();
155  if (!empty($this->_aExtras['txt'])) {
156  $aTxt = $this->_aExtras['txt'];
157  unset($this->_aExtras['txt']);
158  }
159 
160  $aUplMethods = $this->oModule->_oConfig->getUploadersMethods();
161 
162  if (empty($aUploaders)) {
163  $aUploaders = array_keys($aUplMethods);
164  }
165 
166  if (array_key_exists($sMode, $aUplMethods)) {
167  if (is_array($aUplMethods[$sMode])) {
168  $aUplMethods[$sMode]['params'] = array_merge(is_array($aUplMethods[$sMode]['params']) ? $aUplMethods[$sMode]['params'] : array(),
169  array('extras' => $this->_aExtras));
170 
171  $sForm = ChWsbService::callArray($aUplMethods[$sMode]);
172  } elseif (is_string($aUplMethods[$sMode]) && method_exists($this, $aUplMethods[$sMode])) {
173  $sForm = $this->{$aUplMethods[$sMode]}($this->_aExtras);
174  }
175  } else {
176  $sForm = $this->{$aUplMethods[$aUploaders[0]]}($this->_aExtras);
177  }
178  ob_start();
179  ?>
180  <iframe style="display:none;" name="__upload_type___upload_frame"></iframe>
181  <script src="__modules_url__cheetah/__upload_type__s/js/upload.js" type="text/javascript"
182  language="javascript"></script>
183  <script type="text/javascript">
184  var __js_post_object__ = new Ch__upload_type_nc__Upload({
185  iOwnerId: __owner_id__
186  });
187  </script>
188  __form__
189  <div id="__upload_type___accepted_files_block"></div>
190 
191  <div id="__upload_type___success_message" style="display:none;">__box_upl_succ__</div>
192  <div id="__upload_type___failed_file_message" style="display:none;">__box_upl_file_err__</div>
193  <div id="__upload_type___failed_message" style="display:none;">__box_upl_err__</div>
194  <div id="__upload_type___embed_failed_message" style="display:none;">__box_emb_err__</div>
195  <?php
196  $sTempl = ob_get_clean();
197  $aUnit = array(
198  'upload_type' => $this->sUploadTypeLC,
199  'modules_url' => CH_WSB_URL_MODULES,
200  'js_post_object' => $this->_sJsPostObject,
201  'upload_type_nc' => $this->sUploadTypeNC,
202  'owner_id' => $this->_iOwnerId,
203  'form' => $sForm,
204  'box_upl_succ' => MsgBox(_t('_ch_' . $this->sUploadTypeLC . 's_upl_succ')),
205  'box_upl_file_err' => MsgBox(_t('_sys_txt_upload_failed')),
206  'box_upl_err' => MsgBox(_t('_ch_' . $this->sUploadTypeLC . 's_upl_err')),
207  'box_emb_err' => MsgBox(_t('_ch_' . $this->sUploadTypeLC . 's_emb_err')),
208  'txt_select_files' => _t(!empty($aTxt['select_files']) ? $aTxt['select_files'] : '_sys_txt_select_files')
209  );
210  $this->addCss('upload_media_comm.css');
211  $this->addJsTranslation('_ch_' . $this->sUploadTypeLC . 's_emb_err');
212 
213  return $this->parseHtmlByContent($sTempl, $aUnit);
214  }
215 
216  function _getEmbedFormFile()
217  {
218  $aForm = array(
219  'form_attrs' => array(
220  'id' => $this->sUploadTypeLC . '_upload_form',
221  'name' => 'embed',
222  'action' => $this->sWorkingFile,
223  'method' => 'post',
224  'enctype' => 'multipart/form-data',
225  'target' => $this->sUploadTypeLC . '_upload_frame'
226  ),
227  'inputs' => array(
228  'header1' => array(
229  'type' => 'block_header',
230  'caption' => _t('_ch_' . $this->sUploadTypeLC . 's_embed')
231  ),
232  'embed' => array(
233  'type' => 'text',
234  'name' => 'embed',
235  'caption' => _t('_ch_' . $this->sUploadTypeLC . 's_Embed'),
236  'required' => true,
237  ),
238  'example' => array(
239  'type' => 'custom',
240  'name' => 'example',
241  'content' => _t('_ch_' . $this->sUploadTypeLC . 's_Embed_example'),
242  ),
243  'hidden_action' => array(
244  'type' => 'hidden',
245  'name' => 'action',
246  'value' => 'accept_embed'
247  ),
248  'submit' => array(
249  'type' => 'submit',
250  'name' => 'shoot',
251  'value' => _t('_Continue'),
252  'attrs' => array(
253  'onclick' => "return parent." . $this->_sJsPostObject . ".checkEmbed(true) && parent." . $this->_sJsPostObject . "._loading(true); sh{$this->sUploadTypeNC}EnableSubmit(false);",
254  ),
255  ),
256  ),
257  );
258 
259  //--- Process Extras ---//
260  foreach ($this->_aExtras as $sKey => $mixedValue) {
261  $aForm['inputs'][CH_WSB_UPLOADER_EP_PREFIX . $sKey] = array(
262  'type' => 'hidden',
263  'name' => CH_WSB_UPLOADER_EP_PREFIX . $sKey,
264  'value' => $mixedValue
265  );
266  }
267 
269 
270  return $this->getLoadingCode() . $oForm->getCode();
271  }
272 
273  function _getRecordFormFile($sCustomRecorderObject = '', $aExtras = array())
274  {
275  $aForm = array(
276  'form_attrs' => array(
277  'id' => $this->sUploadTypeLC . '_upload_form',
278  'name' => 'record',
279  'action' => $this->sWorkingFile,
280  'method' => 'post',
281  'enctype' => 'multipart/form-data',
282  'target' => $this->sUploadTypeLC . '_upload_frame'
283  ),
284  'inputs' => array(
285  'header1' => array(
286  'type' => 'block_header',
287  'caption' => _t('_ch_' . $this->sUploadTypeLC . 's_record')
288  ),
289  'record' => array(
290  'type' => 'custom',
291  'name' => 'file',
292  'content' => $sCustomRecorderObject,
293  'colspan' => 2
294  ),
295  'hidden_action' => array(
296  'type' => 'hidden',
297  'name' => 'action',
298  'value' => 'accept_record'
299  ),
300  'submit' => array(
301  'type' => 'submit',
302  'name' => 'shoot',
303  'value' => _t('_Continue'),
304  'colspan' => true,
305  'attrs' => array(
306  'disabled' => 'disabled'
307  ),
308  ),
309  ),
310  );
311 
312  //--- Process Extras ---//
313  foreach ($this->_aExtras as $sKey => $mixedValue) {
314  $aForm['inputs'][CH_WSB_UPLOADER_EP_PREFIX . $sKey] = array(
315  'type' => 'hidden',
316  'name' => CH_WSB_UPLOADER_EP_PREFIX . $sKey,
317  'value' => $mixedValue
318  );
319  }
320 
322 
323  return $oForm->getCode();
324  }
325 
326  function getLoadingCode()
327  {
328  return $GLOBALS['oFunctions']->loadingBox('upload-loading-container');
329  }
330 
332  {
333  return '<script src="' . CH_WSB_URL_ROOT . 'plugins/jquery/jquery.js" type="text/javascript" language="javascript"></script>';
334  }
335 
336  function embedReadUrl($sUrl)
337  {
338  return ch_file_get_contents($sUrl);
339  }
340 
341  function embedGetTagContents($sData, $sTag)
342  {
343  $aData = explode("<" . $sTag, $sData, 2);
344  if (strpos($aData[1], ">") > 0) {
345  $aData = explode(">", $aData[1], 2);
346  $sData = $aData[1];
347  } else {
348  $sData = substr($aData[1], 1);
349  }
350  $aData = explode("</" . $sTag . ">", $sData, 2);
351  $sData = $aData[0];
352  $iCdataIndex = strpos($sData, "<![CDATA[");
353  if (is_numeric($iCdataIndex) && $iCdataIndex == 0) {
354  return $this->getStringPart($sData, "<![CDATA[", "]]>");
355  }
356 
357  return $sData;
358  }
359 
360  function embedGetTagAttributes($sData, $sTag, $sAttribute = "")
361  {
362  $aData = explode("<" . $sTag, $sData, 2);
363  $iTagIndex1 = strpos($aData[1], "/>");
364  $iTagIndex = strpos($aData[1], ">");
365 
366  if (!is_integer($iTagIndex1) || $iTagIndex1 > $iTagIndex) {
367  $aData = explode(">", $aData[1], 2);
368  } else {
369  $aData = explode("/>", $aData[1], 2);
370  }
371 
372  $sAttributes = str_replace("'", '"', trim($aData[0]));
373  $aAttributes = array();
374 
375  $sPattern = '(([^=])+="([^"])+")';
376  preg_match_all($sPattern, $sAttributes, $aMatches);
377 
378  $aMatches = $aMatches[0];
379  for ($i = 0; $i < count($aMatches); $i++) {
380  $aData = explode('="', $aMatches[$i]);
381  $aAttributes[trim($aData[0])] = substr($aData[1], 0, strlen($aData[1]) - 1);
382  }
383 
384  return empty($sAttribute) ? $aAttributes : $aAttributes[$sAttribute];
385  }
386 
387  function embedGetStringPart($sData, $sLeft, $sRight)
388  {
389  $aParts = explode($sLeft, $sData, 2);
390  $aParts = explode($sRight, $aParts[1], 2);
391 
392  return count($aParts) == 2 ? $aParts[0] : "";
393  }
394 
396  {
397  if (!$this->_iOwnerId) {
398  return $this->_getAuthorId() ? "" : '<script type="text/javascript">alert("' . ch_js_string(_t('_LOGIN_REQUIRED_AE1')) . '");</script>';
399  }
400  }
401 
408  {
409  $aForm = array(
410  'form_attrs' => array(
411  'id' => $this->sUploadTypeLC . '_upload_form',
412  'name' => 'upload',
413  'action' => ch_append_url_params($this->sWorkingFile, array('action' => 'accept_multi_html5')),
414  'method' => 'post',
415  'enctype' => 'multipart/form-data',
416  'target' => $this->sUploadTypeLC . '_upload_frame'
417  ),
418  'inputs' => array(
419  'submit' => array(
420  'type' => 'submit',
421  'name' => 'submit_form',
422  'value' => _t('_Submit'),
423  ),
424  ),
425  );
426 
427  //--- Process Extras ---//
428  foreach ($this->_aExtras as $sKey => $mixedValue) {
429  $aForm['inputs'][CH_WSB_UPLOADER_EP_PREFIX . $sKey] = array(
430  'type' => 'hidden',
431  'name' => CH_WSB_UPLOADER_EP_PREFIX . $sKey,
432  'value' => $mixedValue
433  );
434  }
435 
437 
438  return $this->getLoadingCode() . $oForm->getCode();
439  }
440 
441  function getUploadHtml5File($aExtras)
442  {
443  $aUploaders = $this->oModule->_oConfig->getUploaders();
444 
445  $aCustomFormData = array();
446  foreach ($this->_aExtras as $sKey => $mixedValue) {
447  $aCustomFormData[CH_WSB_UPLOADER_EP_PREFIX . $sKey] = $mixedValue;
448  }
449 
450  $aVars = array(
451  'upload_type' => $this->sUploadTypeLC,
452  'form' => $this->getUploadFormHtml5Files(),
453  'static_path' => parse_url(CH_WSB_URL_PLUGINS, PHP_URL_PATH),
454  'plugins_url' => CH_WSB_URL_PLUGINS,
455  'preview_size' => 240,
456  'action_url' => ch_append_url_params($this->sWorkingFile,
457  array('action' => $aUploaders['html5']['action'])),
458  'reload_url' => $this->sWorkingFile,
459  'custom_data' => json_encode($aCustomFormData),
460  'max_file_size' => $this->iMaxFilesize,
461  'image_transform' => json_encode($this->getUploadHtml5FileImageTransform()),
462  'image_auto_orientation' => $this->bImageAutoRotate,
463  'accept_mime_type' => $this->sAcceptMimeType,
464  'multiple' => $aExtras['from_wall'] ? '' : 'multiple',
465  'max_file_size_exceeded' => ch_js_string(_t('_sys_txt_upload_size_error',
466  _t_format_size($this->iMaxFilesize)), CH_ESCAPE_STR_APOS),
467  );
468 
469  return $this->parseHtmlByName('uploader_html5.html', $aVars);
470  }
471 
485  function performUpload($sFilePath, $sRealFilename = '', $aInfo = array(), $isMoveUploadedFile = true, $aExtraParams = array())
486  {
487  // override in the particular module
488  }
489 
491  {
492  // override in the particular module, especially photos module
493  return false;
494  }
495 
496  function performAcceptHtml5File($aFiles, &$aReady, $name = 'file')
497  {
498  if (isset($aFiles['tmp_name'])) {
499  $sFilePath = $aFiles['tmp_name'];
500  $sFileName = $_FILES['file']['name'];
501  $aReady[] = $this->performUpload($sFilePath, $sFileName);
502  } else {
503  foreach ($aFiles as $name => $file) {
504  $this->performAcceptHtml5File($file, $aReady, $name);
505  }
506  }
507  }
508 
509  function fetchImagesForAcceptHtml5File($files, &$images, $name = 'file')
510  {
511  if (isset($files['tmp_name'])) {
512  $filename = $files['tmp_name'];
513  list($mime) = explode(';', @mime_content_type($filename));
514 
515  if (strpos($mime, 'image') !== false) {
516  $size = getimagesize($filename);
517  $base64 = base64_encode(file_get_contents($filename));
518 
519  $images[$name] = array(
520  'width' => $size[0]
521  ,
522  'height' => $size[1]
523  ,
524  'mime' => $mime
525  ,
526  'size' => filesize($filename)
527  ,
528  'dataURL' => 'data:' . $mime . ';base64,' . $base64
529  );
530  }
531  } else {
532  foreach ($files as $name => $file) {
533  $this->fetchImagesForAcceptHtml5File($file, $images, $name);
534  }
535  }
536  }
537 
539  {
540  if (!empty($_SERVER['HTTP_ORIGIN'])) {
541  // Enable CORS
542  header('Access-Control-Allow-Origin: ' . $_SERVER['HTTP_ORIGIN']);
543  header('Access-Control-Allow-Methods: POST, GET, OPTIONS');
544  header('Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Range, Content-Disposition, Content-Type');
545  header('Access-Control-Allow-Credentials: true');
546  }
547 
548  if (strtoupper($_SERVER['REQUEST_METHOD']) != 'POST') {
549  exit();
550  }
551 
552  require_once(CH_DIRECTORY_PATH_PLUGINS . 'file-api/server/FileAPI.class.php');
553 
554  $aFiles = FileAPI::getFiles(); // Retrieve File List
555  $aReady = array();
556  $aImages = array();
557 
558  // JSONP callback name
559  $sJsonp = isset($_REQUEST['callback']) ? trim($_REQUEST['callback']) : null;
560 
561  // upload files and return error messages or uploaded file IDs
562  $this->performAcceptHtml5File($aFiles, $aReady);
563 
564  // Fetch all image-info from files list
565  $this->fetchImagesForAcceptHtml5File($aFiles, $aImages);
566 
567  // JSON-data for server response
568  $aJson = array(
569  'files' => $aReady,
570  'images' => $aImages,
571  'data' => array('_REQUEST' => $_REQUEST, '_FILES' => $aFiles),
572  );
573 
574  // Server response: "HTTP/1.1 200 OK"
575  FileAPI::makeResponse(array(
576  'status' => FileAPI::OK,
577  'statusText' => 'OK',
578  'body' => $aJson
579  ), $sJsonp);
580 
581  exit;
582  }
583 
585  {
586  header("Content-type: text/html; charset=utf-8");
587 
588  $sPattern = 'title-';
589  $sOutput = "<script>parent.$(parent.document).trigger('ch-files-cleanup');</script>";
590 
591  if (strtoupper($_SERVER['REQUEST_METHOD']) != 'POST') {
592  die($sOutput);
593  }
594 
595  foreach ($_POST as $k => $s) {
596  if (0 !== strpos($k, $sPattern)) {
597  continue;
598  }
599 
600  if (!($iId = (int)str_replace($sPattern, '', $k))) {
601  continue;
602  }
603 
604  if (!$this->initFile($iId, $s)) {
605  continue;
606  }
607 
608  $this->alertAdd($iId);
609  }
610 
611  die($sOutput);
612  }
613 
614  function getUploadFormFile($aExtras)
615  {
616  $aUploaders = $this->oModule->_oConfig->getUploaders();
617  $aForm = array(
618  'form_attrs' => array(
619  'id' => $this->sUploadTypeLC . '_upload_form',
620  'name' => 'upload',
621  'action' => ch_append_url_params($this->sWorkingFile,
622  array('action' => $aUploaders['regular']['action'])),
623  'method' => 'post',
624  'enctype' => 'multipart/form-data',
625  'target' => $this->sUploadTypeLC . '_upload_frame'
626  ),
627  'inputs' => array(
628  'header1' => array(
629  'type' => 'block_header',
630  'caption' => _t('_ch_' . $this->sUploadTypeLC . 's_upload')
631  ),
632  'browse' => array(
633  'type' => 'file',
634  'name' => 'file[]',
635  'caption' => _t('_ch_' . $this->sUploadTypeLC . 's_browse'),
636  'required' => true,
637  'attrs' => array(
638  'multiplyable' => $aExtras['from_wall'] ? 'false' : 'true',
639  'onchange' => "parent." . $this->_sJsPostObject . ".onFileChangedEvent(this);"
640  )
641  ),
642  'submit' => array(
643  'type' => 'submit',
644  'name' => 'upload',
645  'value' => _t('_Continue'),
646  'colspan' => true,
647  'attrs' => array(
648  'onclick' => "return parent." . $this->_sJsPostObject . "._loading(true);",
649  'disabled' => 'disabled'
650  )
651  ),
652  ),
653  );
654 
655  //--- Process Extras ---//
656  foreach ($this->_aExtras as $sKey => $mixedValue) {
657  $aForm['inputs'][CH_WSB_UPLOADER_EP_PREFIX . $sKey] = array(
658  'type' => 'hidden',
659  'name' => CH_WSB_UPLOADER_EP_PREFIX . $sKey,
660  'value' => $mixedValue
661  );
662  }
663 
665 
666  return $this->getLoadingCode() . $oForm->getCode();
667  }
668 
670  $iFileID,
671  $aDefaultValues = array(),
672  $aPossibleImage = array(),
673  $aPossibleDuration = array()
674  ) {
675  header("Content-type: text/html; charset=utf-8");
676  $this->addJsTranslation(array(
677  '_ch_' . $this->sUploadTypeLC . 's_val_title_err',
678  '_ch_' . $this->sUploadTypeLC . 's_val_descr_err'
679  ));
680 
681  $oCategories = new ChWsbCategories();
682  $oCategories->getTagObjectConfig();
683  $aFormCategories['categories'] = $oCategories->getGroupChooser('ch_' . $this->sUploadTypeLC . 's',
684  $this->_iOwnerId, true);
685  $aFormCategories['categories']['required'] = false;
686  $sKey = 'album';
687  $aAlbums = array();
688  if ($this->_aExtras[$sKey] != '') {
689  $aAlbums[CH_WSB_UPLOADER_EP_PREFIX . $sKey] = array(
690  'type' => 'hidden',
691  'name' => CH_WSB_UPLOADER_EP_PREFIX . $sKey,
692  'value' => stripslashes($this->_aExtras[$sKey])
693  );
694 
695  } else {
696  $oAlbum = new ChWsbAlbums('ch_' . $this->sUploadTypeLC . 's');
697  $aAlbumList = $oAlbum->getAlbumList(array('owner' => $this->_iOwnerId));
698 
699  if (count($aAlbumList) > 0) {
700  foreach ($aAlbumList as $aValue) {
701  $aList[$aValue['ID']] = stripslashes($aValue['Caption']);
702  }
703  } else {
704  $sDefName = $oAlbum->getAlbumDefaultName();
705  $aList[$sDefName] = stripslashes($sDefName);
706  }
707  $aAlbums['album'] = array(
708  'type' => 'select_box',
709  'name' => CH_WSB_UPLOADER_EP_PREFIX . $sKey,
710  'caption' => _t('_sys_album'),
711  'values' => $aList
712  );
713  }
714 
715  $sCaptionVal = ($this->sSendFileInfoFormCaption != '') ? $this->sSendFileInfoFormCaption : _t('_Info');
716  // processing of possible default values
717  $aInputValues = array('title', 'tags', 'description', 'type', $this->sUploadTypeLC);
718  foreach ($aInputValues as $sField) {
719  $sEmpty = $sField == 'type' ? 'upload' : '';
720  $sTemp = isset($aDefaultValues[$sField]) ? strip_tags($aDefaultValues[$sField]) : $sEmpty;
721  $aDefaultValues[$sField] = $sTemp;
722  }
723  $aForm = array(
724  'form_attrs' => array(
725  'id' => $this->sUploadTypeLC . '_file_info_form',
726  'method' => 'post',
727  'action' => $this->sWorkingFile,
728  'target' => 'upload_file_info_frame_' . $iFileID
729  ),
730  'inputs' => array(
731  'header2' => array(
732  'type' => 'block_header',
733  'caption' => $sCaptionVal,
734  'collapsable' => false
735  ),
736  'title' => array(
737  'type' => 'text',
738  'name' => 'title',
739  'caption' => _t('_Title'),
740  'required' => true,
741  'value' => $aDefaultValues['title']
742  ),
743  'tags' => array(
744  'type' => 'text',
745  'name' => 'tags',
746  'caption' => _t('_Tags'),
747  'info' => _t('_Tags_desc'),
748  'value' => $aDefaultValues['tags']
749  ),
750  'description' => array(
751  'type' => 'textarea',
752  'name' => 'description',
753  'caption' => _t('_Description'),
754  'value' => $aDefaultValues['description']
755  ),
756  'media_id' => array(
757  'type' => 'hidden',
758  'name' => 'file_id',
759  'value' => $iFileID,
760  ),
761  'hidden_action' => array(
762  'type' => 'hidden',
763  'name' => 'action',
764  'value' => 'accept_file_info'
765  ),
766  $this->sUploadTypeLC => array(
767  'type' => 'hidden',
768  'name' => $this->sUploadTypeLC,
769  'value' => $aDefaultValues[$this->sUploadTypeLC]
770  ),
771  'type' => array(
772  'type' => 'hidden',
773  'name' => 'type',
774  'value' => $aDefaultValues['type']
775  )
776  ),
777  );
778 
779  //--- Process Extras ---//
780  foreach ($this->_aExtras as $sKey => $mixedValue) {
781  $aForm['inputs'][CH_WSB_UPLOADER_EP_PREFIX . $sKey] = array(
782  'type' => 'hidden',
783  'name' => CH_WSB_UPLOADER_EP_PREFIX . $sKey,
784  'value' => $mixedValue
785  );
786  }
787 
788  // merging categories
789  $aForm['inputs'] = $this->getUploadFormArray($aForm['inputs'], array($aFormCategories, $aAlbums));
790 
791  if (is_array($aPossibleImage) && count($aPossibleImage) > 0) {
792  $aForm['inputs'] = array_merge($aForm['inputs'], $aPossibleImage);
793  }
794 
795  if (is_array($aPossibleDuration) && count($aPossibleDuration) > 0) {
796  $aForm['inputs'] = array_merge($aForm['inputs'], $aPossibleDuration);
797  }
798 
799  $aForm['inputs'][] = array(
800  'type' => 'input_set',
801  'colspan' => true,
802  0 => array(
803  'type' => 'submit',
804  'name' => 'upload',
805  'value' => _t('_Submit'),
806  'colspan' => true,
807  'attrs' => array(
808  'onclick' => "return parent." . $this->_sJsPostObject . ".doValidateFileInfo(this, '" . $iFileID . "');",
809  )
810  ),
811  1 => array(
812  'type' => 'button',
813  'name' => 'delete',
814  'value' => _t('_ch_' . $this->sUploadTypeLC . 's_admin_delete'),
815  'colspan' => true,
816  'attrs' => array(
817  'onclick' => "return parent." . $this->_sJsPostObject . ".cancelSendFileInfo('" . $iFileID . "', '" . ('record' == $aDefaultValues['type'] || 'embed' == $aDefaultValues['type'] ? '' : $this->sWorkingFile) . "'); ",
818  )
819  )
820  );
821 
823  $sForm = $this->parseHtmlByName('uploader_regular_info.html', array(
824  'id' => $iFileID,
825  'form' => $oForm->getCode()
826  ));
827  $sForm = str_replace(array("'", "\r", "\n"), array("\'"), $sForm);
828 
829  return "<script src='" . CH_WSB_URL_ROOT . "inc/js/jquery.webForms.js' type='text/javascript' language='javascript'></script><script type='text/javascript'>parent." . $this->_sJsPostObject . ".genSendFileInfoForm('" . $iFileID . "', '" . $sForm . "'); parent." . $this->_sJsPostObject . "._loading(false);</script>";
830  }
831 
832  // method for checking album existense and adding object there
834  &$oAlbums,
835  $sAlbumUri,
836  $iObjId,
837  $bUpdateCounter = true,
838  $iAuthorId = 0,
839  $aAlbumParams = array()
840  ) {
841  if (!$iAuthorId) {
842  $iAuthorId = $this->_iOwnerId;
843  }
844  $iObjId = (int)$iObjId;
845  $aAlbumInfo = $oAlbums->getAlbumInfo(array('fileUri' => uriFilter($sAlbumUri), 'owner' => $iAuthorId),
846  array('ID'));
847  if (is_array($aAlbumInfo) && count($aAlbumInfo) > 0) {
848  $iAlbumID = (int)$aAlbumInfo['ID'];
849  } else {
850  if (isset($aAlbumParams['privacy'])) {
851  $iPrivacy = (int)$aAlbumParams['privacy'];
852  } elseif ($sAlbumUri == $oAlbums->getAlbumDefaultName()) {
853  $iPrivacy = CH_WSB_PG_HIDDEN;
854  } else {
855  ch_import('ChWsbPrivacyQuery');
856  $oPrivacy = new ChWsbPrivacyQuery();
857  $iPrivacy = $oPrivacy->getDefaultValueModule($this->oModule->_oConfig->getUri(), 'album_view');
858  if (!$iPrivacy) {
859  $iPrivacy = CH_WSB_PG_NOBODY;
860  }
861  }
862 
863  $aData = array(
864  'caption' => $sAlbumUri,
865  'owner' => $iAuthorId,
866  'AllowAlbumView' => $iPrivacy
867  );
868  $iAlbumID = $oAlbums->addAlbum($aData, false);
869  }
870  $oAlbums->addObject($iAlbumID, $iObjId, $bUpdateCounter);
871  }
872 
873  function getUploadFormArray(&$aForm, $aAddObjects = array())
874  {
875  if (is_array($aAddObjects) && !empty($aAddObjects)) {
876  foreach ($aAddObjects as $aField) {
877  $aForm = array_merge($aForm, $aField);
878  }
879  }
880 
881  return $aForm;
882  }
883 
885  {
886  return $this->oModule->_oConfig->checkAllowedExts(strtolower($sExt));
887  }
888 
898  {
899  $sCode = '';
900  $aUploaders = $this->oModule->_oConfig->getUploaders();
901  foreach ($aUploaders as $k => $r) {
902  if ($sAction != $r['action']) {
903  continue;
904  }
905 
906  if (is_array($r['handle'])) {
907  $sCode = ChWsbService::callArray($r['handle']);
908  } elseif (is_string($r['handle']) && method_exists($this, $r['handle'])) {
909  $sCode = $this->{$r['handle']}();
910  }
911 
912  break;
913  }
914 
915  return $sCode;
916  }
917 
918  function serviceAcceptFile()
919  {
920  $sResult = '';
921  if ($_FILES) {
922  for ($i = 0; $i < count($_FILES['file']['tmp_name']); $i++) {
923  if ($_FILES['file']['error'][$i]) {
924  if ($_FILES['file']['error'][$i] == UPLOAD_ERR_INI_SIZE) {
925  $sResult .= $this->getFileAddError(_t('_sys_txt_upload_size_error',
926  _t_format_size($this->iMaxFilesize)));
927  }
928  continue;
929  }
930  $sResult .= $this->_shareFile($_FILES['file']['tmp_name'][$i], true, $_FILES['file']['name'][$i],
931  array('file_type' => $_FILES['file']['type'][$i]));
932  }
933  } else {
934  $sResult = $this->getFileAddError(_t('_sys_txt_upload_size_error', _t_format_size($this->iMaxFilesize)));
935  }
936 
937  return $sResult != '' ? $this->GenJquieryInjection() . $sResult : '';
938  }
939 
940  function initFile($iMedID, $sTitle, $sCategories = '', $sTags = '', $sDesc = '', $aCustom = array())
941  {
942  $sMedUri = uriGenerate($sTitle, $this->oModule->_oDb->sFileTable, $this->oModule->_oDb->aFileFields['medUri']);
943 
944  // If title is empty, generate a uri from microtime.
945  if($sTitle == '') {
946  $sMedUri = dechex($iMedID . str_replace('.', '0', microtime(true)));
947  }
948 
949  $aFields = array(
950  'Categories' => $sCategories,
951  'medTitle' => $sTitle,
952  'medTags' => $sTags,
953  'medDesc' => $sDesc,
954  'medUri' => $sMedUri
955  );
956  if ($aCustom) {
957  $aFields = array_merge($aFields, $aCustom);
958  }
959 
960  $bRes = $this->oModule->_oDb->updateData($iMedID, $aFields);
961 
962  if ($bRes) {
963  $oTag = new ChWsbTags();
964  $oTag->reparseObjTags($this->oModule->_oConfig->sPrefix, $iMedID);
965  $oCateg = new ChWsbCategories();
966  $oCateg->reparseObjTags($this->oModule->_oConfig->sPrefix, $iMedID);
967  }
968 
969  return $bRes;
970  }
971 
972  function alertAdd($iMedID, $bCheckPrivacy = false)
973  {
974  $aExtra = $this->_getExtraParams($_POST);
975  $aExtra = $this->_updateExtraParams($aExtra, $iMedID, $this->_iOwnerId);
976 
977  if (!$bCheckPrivacy || !isset($aExtra['privacy_view']) || (int)$aExtra['privacy_view'] != (int)CH_WSB_PG_HIDDEN) {
978  $oZ = new ChWsbAlerts($this->oModule->_oConfig->sPrefix, 'add', $iMedID, $this->_iOwnerId, $aExtra);
979  $oZ->alert();
980  }
981  }
982 
984  {
985  $iFileID = (int)$_GET['file_id'];
986  if ($iFileID && $this->oModule->serviceRemoveObject($iFileID)) {
987  return 1;
988  }
989 
990  return 0;
991  }
992 
993  function _shareFile($sFilePath, $isMoveUploadedFile = true, $sRealFilename = '', $aExtraParams = array())
994  {
995  $a = $this->performUpload($sFilePath, $sRealFilename, array(), $isMoveUploadedFile, $aExtraParams);
996 
997  // success
998  if (isset($a['id']) && $a['id']) {
999  $aDefault = array('title' => $this->sTempFilename);
1000 
1001  return $this->GenSendFileInfoForm($a['id'], $aDefault);
1002  }
1003 
1004  // error
1005  return $this->getFileAddError(isset($a['error']) ? $a['error'] : '');
1006  }
1007 
1009  {
1010  $sMessage = empty($sMessage) ? _t('_sys_txt_upload_failed') : $sMessage;
1011 
1012  return '<script type="text/javascript">alert("' . ch_js_string($sMessage) . '"); parent.' . $this->_sJsPostObject . '._loading(false);</script>';
1013  }
1014 
1015  function GenMainAddFilesForm($aExtras = array())
1016  {
1017  $aUploaders = array_keys($this->oModule->_oConfig->getUploaderList());
1018 
1019  return $this->_GenMainAddCommonForm($aExtras, $aUploaders);
1020  }
1021 
1026  {
1027  return $this->oModule->_oConfig->getUploaderList();
1028  }
1029 
1035  function serviceGetUploaderForm($aExtras)
1036  {
1037  return $this->GenMainAddFilesForm($aExtras);
1038  }
1039 
1040  function insertSharedMediaToDb($sExt, $aFileInfo, $iAuthorId = 0, $aExtraData = array())
1041  {
1042  if (!$iAuthorId) {
1043  $iAuthorId = $this->_iOwnerId;
1044  }
1045 
1046  if (getParam($this->oModule->_oConfig->aGlParams['auto_activation']) == 'on') {
1047  $bAutoActivate = true;
1048  $sStatus = 'approved';
1049  } else {
1050  $bAutoActivate = false;
1051  $sStatus = 'pending';
1052  }
1053  $sFileTitle = $aFileInfo['medTitle'];
1054  $sFileDesc = $aFileInfo['medDesc'];
1055  $sFileTags = $aFileInfo['medTags'];
1056  $sCategory = implode(CATEGORIES_DIVIDER, $aFileInfo['Categories']);
1057  $sDimension = isset($aFileInfo['dimension']) ? $aFileInfo['dimension'] : (int)$aFileInfo['medSize'];
1058 
1059  $sAlbum = mb_strlen($_POST['extra_param_album']) > 0 ? $_POST['extra_param_album'] : getParam('sys_album_default_name');
1060  $sAlbum = isset($aFileInfo['album']) ? $aFileInfo['album'] : $sAlbum;
1061 
1062  $sMedUri = uriGenerate($sFileTitle, $this->oModule->_oDb->sFileTable,
1063  $this->oModule->_oDb->aFileFields['medUri']);
1064  $sExtDb = trim($sExt, '.');
1065  $sCurTime = time();
1066 
1067  $aData = array(
1068  'medProfId' => $iAuthorId,
1069  'medExt' => $sExtDb,
1070  'medTitle' => $sFileTitle,
1071  'medUri' => $sMedUri,
1072  'medDesc' => $sFileDesc,
1073  'medTags' => $sFileTags,
1074  'Categories' => $sCategory,
1075  'medSize' => $sDimension,
1076  'Approved' => $sStatus,
1077  'medDate' => $sCurTime,
1078  );
1079  $aData = array_merge($aData, $aExtraData);
1080  $iInsertedID = $this->oModule->_oDb->insertData($aData);
1081 
1082  if (0 < $iInsertedID) {
1083  $oTag = new ChWsbTags();
1084  $oTag->reparseObjTags($this->oModule->_oConfig->sPrefix, $iInsertedID);
1085 
1086  $oCateg = new ChWsbCategories();
1087  $oCateg->reparseObjTags($this->oModule->_oConfig->sPrefix, $iInsertedID);
1088 
1089  $aAlbumParams = isset($aFileInfo['albumPrivacy']) ? array('privacy' => $aFileInfo['albumPrivacy']) : array();
1090  $this->addObjectToAlbum($this->oModule->oAlbums, $sAlbum, $iInsertedID, $bAutoActivate, $iAuthorId,
1091  $aAlbumParams);
1092 
1093  return $iInsertedID;
1094  }
1095 
1096  return 0;
1097  }
1098 }
header
</code > Be careful enabling this directive if you have a redirector script that does not use the< code > Location</code > HTTP header
Definition: URI.MungeResources.txt:10
FileAPI\getFiles
static getFiles()
Definition: FileAPI.class.php:93
ChWsbFilesUploader
Definition: ChWsbFilesUploader.php:13
ChWsbFilesUploader\initFile
initFile($iMedID, $sTitle, $sCategories='', $sTags='', $sDesc='', $aCustom=array())
Definition: ChWsbFilesUploader.php:940
ChWsbFilesUploader\addObjectToAlbum
addObjectToAlbum(&$oAlbums, $sAlbumUri, $iObjId, $bUpdateCounter=true, $iAuthorId=0, $aAlbumParams=array())
Definition: ChWsbFilesUploader.php:833
$sMessage
$sMessage
Definition: actions.inc.php:17
ChWsbFilesUploader\serviceAcceptHtml5FilesInfo
serviceAcceptHtml5FilesInfo()
Definition: ChWsbFilesUploader.php:584
ChTemplFormView
Definition: ChTemplFormView.php:11
ChWsbFilesUploader\GenMainAddFilesForm
GenMainAddFilesForm($aExtras=array())
Definition: ChWsbFilesUploader.php:1015
ChWsbFilesUploader\$_sJsPostObject
$_sJsPostObject
Definition: ChWsbFilesUploader.php:15
ChWsbTemplate
Definition: ChWsbTemplate.php:121
$sMode
else $sMode
Definition: antispam.php:362
ChWsbFilesUploader\serviceGetUploaderForm
serviceGetUploaderForm($aExtras)
Definition: ChWsbFilesUploader.php:1035
MsgBox
MsgBox($sText, $iTimer=0)
Definition: design.inc.php:175
ChWsbFilesUploader\_GenMainAddCommonForm
_GenMainAddCommonForm($aExtras=array(), $aUploaders=array())
Definition: ChWsbFilesUploader.php:148
ChWsbFilesUploader\_getRecordFormFile
_getRecordFormFile($sCustomRecorderObject='', $aExtras=array())
Definition: ChWsbFilesUploader.php:273
ChWsbFilesUploader\insertSharedMediaToDb
insertSharedMediaToDb($sExt, $aFileInfo, $iAuthorId=0, $aExtraData=array())
Definition: ChWsbFilesUploader.php:1040
ch_js_string
ch_js_string($mixedInput, $iQuoteType=CH_ESCAPE_STR_AUTO)
Definition: utils.inc.php:1294
$aUnit
$aUnit
Definition: short_profile_info.php:31
uriGenerate
uriGenerate($s, $sTable, $sField, $iMaxLen=255)
Definition: utils.inc.php:900
name
Core AllowHostnameUnderscore underscores are not permitted in host most browsers do the right thing when faced with an underscore in the host name
Definition: Core.AllowHostnameUnderscore.txt:11
$sCode
$sCode
Definition: explanation.php:19
$sResult
$sResult
Definition: advanced_settings.php:26
ChWsbFilesUploader\checkAuthorBeforeAdd
checkAuthorBeforeAdd()
Definition: ChWsbFilesUploader.php:395
ChWsbFilesUploader\_shareFile
_shareFile($sFilePath, $isMoveUploadedFile=true, $sRealFilename='', $aExtraParams=array())
Definition: ChWsbFilesUploader.php:993
ChWsbFilesUploader\_addHidden
_addHidden($sPostType="photo", $sContentType="upload", $sAction="post", $iIndex=1)
Definition: ChWsbFilesUploader.php:61
ChWsbFilesUploader\getFileAddError
getFileAddError($sMessage='')
Definition: ChWsbFilesUploader.php:1008
ch_import
ch_import($sClassName, $aModule=array())
Definition: utils.inc.php:1218
$aResult
$aResult
Definition: index.php:19
ChWsbFilesUploader\__construct
__construct($sUploadTypeNC='Common')
Definition: ChWsbFilesUploader.php:32
ChWsbFilesUploader\embedGetTagContents
embedGetTagContents($sData, $sTag)
Definition: ChWsbFilesUploader.php:341
ChWsbTemplate\addCss
addCss($mixedFiles, $bDynamic=false)
Definition: ChWsbTemplate.php:1114
FileAPI\OK
const OK
Definition: FileAPI.class.php:3
ChWsbPrivacyQuery
Definition: ChWsbPrivacyQuery.php:11
ChWsbFilesUploader\embedReadUrl
embedReadUrl($sUrl)
Definition: ChWsbFilesUploader.php:336
$sUrl
$sUrl
Definition: cart.php:15
ChWsbFilesUploader\embedGetStringPart
embedGetStringPart($sData, $sLeft, $sRight)
Definition: ChWsbFilesUploader.php:387
php
$oZ
$oZ
Definition: db.php:20
CH_WSB_PG_HIDDEN
const CH_WSB_PG_HIDDEN
Definition: ChWsbPrivacy.php:17
ChWsbTags
Definition: ChWsbTags.php:15
$iId
$iId
Definition: license.php:15
FileAPI\makeResponse
static makeResponse(array $res, $jsonp=null)
Definition: FileAPI.class.php:114
ChWsbFilesUploader\getUploadHtml5FileImageTransform
getUploadHtml5FileImageTransform()
Definition: ChWsbFilesUploader.php:490
ChWsbFilesUploader\$iMaxFilesize
$iMaxFilesize
Definition: ChWsbFilesUploader.php:20
ChWsbFilesUploader\serviceAcceptFile
serviceAcceptFile()
Definition: ChWsbFilesUploader.php:918
$sExt
$sExt
Definition: get_file.php:14
ChWsbFilesUploader\$_aExtras
$_aExtras
Definition: ChWsbFilesUploader.php:17
ChWsbFilesUploader\$sTempFilename
$sTempFilename
Definition: ChWsbFilesUploader.php:27
ChWsbFilesUploader\serviceAcceptHtml5File
serviceAcceptHtml5File()
Definition: ChWsbFilesUploader.php:538
ChWsbCategories
Definition: ChWsbCategories.php:13
_t_format_size
_t_format_size($iBytes, $iPrecision=2)
Definition: languages.inc.php:545
CATEGORIES_DIVIDER
const CATEGORIES_DIVIDER
Definition: ChWsbCategories.php:10
ChWsbFilesUploader\embedGetTagAttributes
embedGetTagAttributes($sData, $sTag, $sAttribute="")
Definition: ChWsbFilesUploader.php:360
return_bytes
return_bytes($val)
Definition: utils.inc.php:1591
$aInfo
$aInfo
Definition: constants.inc.php:21
$oForm
$oForm
Definition: host_tools.php:42
ChWsbTemplate\parseHtmlByContent
parseHtmlByContent($sContent, $aVariables, $mixedKeyWrapperHtml=null)
Definition: ChWsbTemplate.php:687
ChWsbService\callArray
static callArray($a)
Definition: ChWsbService.php:44
ChWsbAlerts
Definition: ChWsbAlerts.php:39
ChWsbFilesUploader\_GenSendFileInfoForm
_GenSendFileInfoForm( $iFileID, $aDefaultValues=array(), $aPossibleImage=array(), $aPossibleDuration=array())
Definition: ChWsbFilesUploader.php:669
ChWsbFilesUploader\$oModule
$oModule
Definition: ChWsbFilesUploader.php:29
exit
exit
Definition: cart.php:21
ChWsbFilesUploader\serviceGetUploadersList
serviceGetUploadersList()
Definition: ChWsbFilesUploader.php:1025
$_GET
$_GET['debug']
Definition: index.php:67
ChWsbFilesUploader\$sWorkingFile
$sWorkingFile
Definition: ChWsbFilesUploader.php:16
$iIndex
$iIndex
Definition: bottom_menu_compose.php:142
$aFields
$aFields
Definition: preValues.php:19
ChWsbFilesUploader\$_iOwnerId
$_iOwnerId
Definition: ChWsbFilesUploader.php:14
getParam
getParam($sParamName, $bUseCache=true)
Definition: db.inc.php:130
ChWsbFilesUploader\getUploadFormFile
getUploadFormFile($aExtras)
Definition: ChWsbFilesUploader.php:614
CH_WSB_UPLOADER_EP_PREFIX
const CH_WSB_UPLOADER_EP_PREFIX
Definition: ChWsbFilesUploader.php:10
ChWsbTemplate\addJsTranslation
addJsTranslation($mixedKey)
Definition: ChWsbTemplate.php:447
getLoggedId
getLoggedId()
Definition: profiles.inc.php:32
$sTitle
$sTitle
Definition: actions.inc.php:13
ChWsbFilesUploader\$sSendFileInfoFormCaption
$sSendFileInfoFormCaption
Definition: ChWsbFilesUploader.php:19
CH_WSB_PG_NOBODY
const CH_WSB_PG_NOBODY
Definition: ChWsbPrivacy.php:11
ChWsbFilesUploader\_getExtraParams
_getExtraParams(&$aRequest)
Definition: ChWsbFilesUploader.php:112
ch_append_url_params
ch_append_url_params($sUrl, $mixedParams)
Definition: utils.inc.php:1697
ChWsbAlbums
Definition: ChWsbAlbums.php:9
$_REQUEST
$_REQUEST['action']
Definition: cmd.php:11
$sTags
$sTags
Definition: actions.inc.php:12
type
if(!defined("USER_STATUS_TYPE")) define("USER_STATUS_TYPE" type
Definition: constants.inc.php:13
src
img src
Definition: URI.MungeResources.txt:8
uriFilter
uriFilter($s)
Definition: utils.inc.php:931
ch_file_get_contents
ch_file_get_contents($sFileUrl, $aParams=array(), $sMethod='get', $aHeaders=array(), &$sHttpCode=null)
Definition: utils.inc.php:1357
ChWsbFilesUploader\alertAdd
alertAdd($iMedID, $bCheckPrivacy=false)
Definition: ChWsbFilesUploader.php:972
ChWsbFilesUploader\$sAcceptMimeType
$sAcceptMimeType
Definition: ChWsbFilesUploader.php:21
ChWsbFilesUploader\serviceCancelFileInfo
serviceCancelFileInfo()
Definition: ChWsbFilesUploader.php:983
_t
_t($key, $arg0="", $arg1="", $arg2="")
Definition: languages.inc.php:509
ChWsbFilesUploader\fetchImagesForAcceptHtml5File
fetchImagesForAcceptHtml5File($files, &$images, $name='file')
Definition: ChWsbFilesUploader.php:509
time
that in the case of a Adaptation or at a minimum such credit will if a credit for all contributing authors of the Adaptation or Collection then as part of these credits and in a manner at least as prominent as the credits for the other contributing authors For the avoidance of You may only use the credit required by this Section for the purpose of attribution in the manner set out above by exercising Your rights under this You may not implicitly or explicitly assert or imply any connection sponsorship or endorsement by the Original Licensor and or Attribution as of You or Your use of the without the express prior written permission of the Original Licensor and or Attribution Parties Except as otherwise agreed in writing by the Licensor or as may be otherwise permitted by applicable if You Distribute or Publicly Perform the Work either by itself or as part of any Adaptations or You must not modify or take other derogatory action in relation to the Work which would be prejudicial to the Original Author s honor or reputation Licensor agrees that in those in which any exercise of the right granted in modification or other derogatory action prejudicial to the Original Author s honor and the Licensor will waive or not as this to the fullest extent permitted by the applicable national to enable You to reasonably exercise Your right under Warranties and Disclaimer UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN LICENSOR OFFERS THE WORK AS IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE STATUTORY OR WITHOUT WARRANTIES OF FITNESS FOR A PARTICULAR OR THE ABSENCE OF LATENT OR OTHER OR THE PRESENCE OF ABSENCE OF WHETHER OR NOT DISCOVERABLE SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED SO SUCH EXCLUSION MAY NOT APPLY TO YOU Limitation on Liability EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES Termination This License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License Individuals or entities who have received Adaptations or Collections from You under this will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses and will survive any termination of this License Subject to the above terms and the license granted here is Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time
Definition: license.txt:56
ChWsbFilesUploader\GenJquieryInjection
GenJquieryInjection()
Definition: ChWsbFilesUploader.php:331
$sOutput
$sOutput
Definition: r.php:26
$aVars
$aVars
Definition: license.php:101
ChWsbFilesUploader\_getEmbedFormFile
_getEmbedFormFile()
Definition: ChWsbFilesUploader.php:216
$s
$s
Definition: embed.php:13
ChWsbFilesUploader\$sUploadTypeLC
$sUploadTypeLC
Definition: ChWsbFilesUploader.php:25
CH_ESCAPE_STR_APOS
const CH_ESCAPE_STR_APOS
escape apostrophes only, for js strings enclosed in apostrophes, for use in
Definition: utils.inc.php:33
ChWsbFilesUploader\_updateExtraParams
_updateExtraParams($aExtra, $iFileId, $iAuthorId)
Definition: ChWsbFilesUploader.php:124
ChWsbFilesUploader\getUploadFormArray
getUploadFormArray(&$aForm, $aAddObjects=array())
Definition: ChWsbFilesUploader.php:873
$iFileId
$iFileId
Definition: embed.php:12
ChWsbFilesUploader\getLoadingCode
getLoadingCode()
Definition: ChWsbFilesUploader.php:326
ChWsbFilesUploader\serviceIsExtAllowed
serviceIsExtAllowed($sExt)
Definition: ChWsbFilesUploader.php:884
$aForm
$aForm
Definition: forgot.php:43
ChWsbFilesUploader\serviceAcceptUpload
serviceAcceptUpload($sAction)
Definition: ChWsbFilesUploader.php:897
ChWsbFilesUploader\getUploadHtml5File
getUploadHtml5File($aExtras)
Definition: ChWsbFilesUploader.php:441
$sForm
$sForm
Definition: forgot.php:118
$sAction
$sAction
Definition: categories.php:274
ChWsbFilesUploader\_getAuthorId
_getAuthorId()
Definition: ChWsbFilesUploader.php:102
ChWsbFilesUploader\$bImageAutoRotate
$bImageAutoRotate
Definition: ChWsbFilesUploader.php:22
empty
Attr AllowedRel this is empty
Definition: Attr.AllowedRel.txt:7
$sDesc
$sDesc
Definition: actions.inc.php:21
ChWsbFilesUploader\performUpload
performUpload($sFilePath, $sRealFilename='', $aInfo=array(), $isMoveUploadedFile=true, $aExtraParams=array())
Definition: ChWsbFilesUploader.php:485
as
as
Definition: Filter.ExtractStyleBlocks.Escaping.txt:10
ChWsbFilesUploader\_getAuthorPassword
_getAuthorPassword()
Definition: ChWsbFilesUploader.php:107
$sStatus
$sStatus
Definition: actions.inc.php:11
ChWsbTemplate\parseHtmlByName
parseHtmlByName($sName, $aVariables, $mixedKeyWrapperHtml=null, $sCheckIn=CH_WSB_TEMPLATE_CHECK_IN_BOTH)
Definition: ChWsbTemplate.php:660
ChWsbFilesUploader\getUploadFormHtml5Files
getUploadFormHtml5Files()
Definition: ChWsbFilesUploader.php:407
ChWsbFilesUploader\performAcceptHtml5File
performAcceptHtml5File($aFiles, &$aReady, $name='file')
Definition: ChWsbFilesUploader.php:496
ChWsbFilesUploader\$sUploadTypeNC
$sUploadTypeNC
Definition: ChWsbFilesUploader.php:24
$GLOBALS
$GLOBALS['iAdminPage']
Definition: advanced_settings.php:10
isMember
isMember($iId=0)
Definition: profiles.inc.php:44