Submit
Path:
~
/
home
/
bfxleof
/
www
/
wp-content
/
plugins
/
loco-translate
/
src
/
ajax
/
File Content:
UploadController.php
<?php /** * Ajax "upload" route, for putting translation files to the server */ class Loco_ajax_UploadController extends Loco_ajax_common_BundleController { /** * {@inheritdoc} */ public function render(){ $post = $this->validate(); $href = $this->process( $post ); // $this->set('redirect',$href); return parent::render(); } /** * Upload processor shared with standard postback controller * @param Loco_mvc_ViewParams script input * @return string redirect to file edit */ public function process( Loco_mvc_ViewParams $post ){ $bundle = $this->getBundle(); $project = $this->getProject( $bundle ); // Chosen folder location should be valid as a posted "dir" parameter if( ! $post->has('dir') ){ throw new Loco_error_Exception('No destination posted'); } $base = loco_constant('WP_CONTENT_DIR'); $parent = new Loco_fs_Directory($post->dir); $parent->normalize($base); // Loco_error_AdminNotices::debug('Destination set to '.$parent->getPath() ); // Ensure file uploaded ok if( ! isset($_FILES['f']) ){ throw new Loco_error_Exception('No file posted'); } $upload = new Loco_data_Upload($_FILES['f']); $dummy = new Loco_fs_DummyFile( $upload->getName() ); $ext = strtolower( $dummy->extension() ); // Loco_error_AdminNotices::debug('Have uploaded file: '.$dummy->basename() ); switch($ext){ case 'po': case 'mo': $dummy->putContents($upload->getContents()); $pomo = Loco_gettext_Data::load($dummy); break; default: throw new Loco_error_Exception('Only PO/MO uploads supported'); } // PO/MO data is valid. // get real file name and establish if a locale can be extracted, otherwise get from headers $file = new Loco_fs_LocaleFile( $dummy->basename() ); $locale = $file->getLocale(); if( ! $locale->isValid() ){ $value = $pomo->getHeaders()->offsetGet('Language'); $locale = Loco_Locale::parse($value); if( ! $locale->isValid() ){ throw new Loco_error_Exception('Unable to detect language from '.$file->basename() ); } } // Fail if user presents å wrongly named file. This is to avoid mixing up text domains. $pofile = $project->initLocaleFile($parent,$locale); if( $pofile->filename() !== $dummy->filename() ){ throw new Loco_error_Exception( sprintf('File must be named %s', $pofile->filename().'.'.$ext ) ); } // Avoid processing if uploaded PO file is identical to existing one if( $pofile->exists() && 'po' === $ext && $pofile->md5() === $dummy->md5() ){ throw new Loco_error_Exception( __('Your file is identical to the existing one','loco-translate') ); } // recompile all files including uploaded one $compiler = new Loco_gettext_Compiler($pofile); $compiler->writeAll($pomo,$project); // push recent items on file creation Loco_data_RecentItems::get()->pushBundle($bundle)->persist(); // Redirect to edit this PO. Sync may be required and we're not doing automatically here. $type = strtolower( $this->get('type') ); return Loco_mvc_AdminRouter::generate( sprintf('%s-file-edit',$type), array( 'path' => $pofile->getRelativePath($base), 'bundle' => $bundle->getHandle(), 'domain' => $project->getId(), ) ); } }
Submit
FILE
FOLDER
Name
Size
Permission
Action
common
---
0755
ApisController.php
4590 bytes
0644
DiffController.php
1914 bytes
0644
DownloadConfController.php
945 bytes
0644
DownloadController.php
1900 bytes
0644
FsConnectController.php
7112 bytes
0644
FsReferenceController.php
7772 bytes
0644
MsginitController.php
6683 bytes
0644
PingController.php
647 bytes
0644
SaveController.php
3455 bytes
0644
SyncController.php
5940 bytes
0644
UploadController.php
3685 bytes
0644
XgettextController.php
2906 bytes
0644
class-sitemaps-admin.php
3665 bytes
0644
class-wpseo-statistics.php
1443 bytes
0644
class.pack.database.php
30838 bytes
0644
ctrl.package.php
17073 bytes
0644
duplicator.php
1781 bytes
0644
elFinderPlugin.php
3331 bytes
0644
elFinderVolumeDropbox.class.php
41782 bytes
0644
elFinderVolumeLocalFileSystem.class-20260623050500-20260706072032.php
48544 bytes
0644
elFinderVolumeLocalFileSystem.class-20260623050500.php
48544 bytes
0644
elFinderVolumeLocalFileSystem.class.php
48544 bytes
0644
exceptions.php
708 bytes
0644
manager.php
14659 bytes
0644
module.php
1297 bytes
0644
setup.php
2699 bytes
0644
N4ST4R_ID | Naxtarrr