| 57 |
if (file_exists( $path )) { |
if (file_exists( $path )) { |
| 58 |
require $path; |
require $path; |
| 59 |
} else { |
} else { |
| 60 |
echo "Installer not found for element [$element]"; |
echo T_('Installer not found for element')." [$element]"; |
| 61 |
} |
} |
| 62 |
break; |
break; |
| 63 |
} |
} |
| 64 |
} else { |
} else { |
| 65 |
echo "Installer not available for element [$element]"; |
echo T_('Installer not available for element')." [$element]"; |
| 66 |
} |
} |
| 67 |
|
|
| 68 |
/** |
/** |
| 77 |
|
|
| 78 |
// Check if file uploads are enabled |
// Check if file uploads are enabled |
| 79 |
if (!(bool)ini_get('file_uploads')) { |
if (!(bool)ini_get('file_uploads')) { |
| 80 |
HTML_installer::showInstallMessage( "The installer can't continue before file uploads are enabled. Please use the install from directory method.", |
HTML_installer::showInstallMessage( T_("The installer can't continue before file uploads are enabled. Please use the install from directory method."), |
| 81 |
'Installer - Error', $installer->returnTo( $option, $element, $client ) ); |
'Installer - Error', $installer->returnTo( $option, $element, $client ) ); |
| 82 |
exit(); |
exit(); |
| 83 |
} |
} |
| 84 |
|
|
| 85 |
// Check that the zlib is available |
// Check that the zlib is available |
| 86 |
if(!extension_loaded('zlib')) { |
if(!extension_loaded('zlib')) { |
| 87 |
HTML_installer::showInstallMessage( "The installer can't continue before zlib is installed", |
HTML_installer::showInstallMessage( T_("The installer can't continue before zlib is installed"), |
| 88 |
'Installer - Error', $installer->returnTo( $option, $element, $client ) ); |
T_('Installer - Error'), $installer->returnTo( $option, $element, $client ) ); |
| 89 |
exit(); |
exit(); |
| 90 |
} |
} |
| 91 |
|
|
| 92 |
$userfile = mosGetParam( $_FILES, 'userfile', null ); |
$userfile = mosGetParam( $_FILES, 'userfile', null ); |
| 93 |
|
|
| 94 |
if (!$userfile) { |
if (!$userfile) { |
| 95 |
HTML_installer::showInstallMessage( 'No file selected', 'Upload new module - error', |
HTML_installer::showInstallMessage( T_('No file selected'), T_('Upload new module - error'), |
| 96 |
$installer->returnTo( $option, $element, $client )); |
$installer->returnTo( $option, $element, $client )); |
| 97 |
exit(); |
exit(); |
| 98 |
} |
} |
| 104 |
|
|
| 105 |
if ($resultdir !== false) { |
if ($resultdir !== false) { |
| 106 |
if (!$installer->upload( $userfile['name'] )) { |
if (!$installer->upload( $userfile['name'] )) { |
| 107 |
HTML_installer::showInstallMessage( $installer->getError(), 'Upload '.$element.' - Upload Failed', |
HTML_installer::showInstallMessage( $installer->getError(), T_('Upload').' '.$element.' - '.T_('Upload Failed'), |
| 108 |
$installer->returnTo( $option, $element, $client ) ); |
$installer->returnTo( $option, $element, $client ) ); |
| 109 |
} |
} |
| 110 |
$ret = $installer->install(); |
$ret = $installer->install(); |
| 111 |
|
|
| 112 |
HTML_installer::showInstallMessage( $installer->getError(), 'Upload '.$element.' - '.($ret ? 'Success' : 'Failed'), |
HTML_installer::showInstallMessage( $installer->getError(), 'Upload '.$element.' - '.($ret ? T_('Success') : T_('Failed')), |
| 113 |
$installer->returnTo( $option, $element, $client ) ); |
$installer->returnTo( $option, $element, $client ) ); |
| 114 |
cleanupInstall( $userfile['name'], $installer->unpackDir() ); |
cleanupInstall( $userfile['name'], $installer->unpackDir() ); |
| 115 |
} else { |
} else { |
| 116 |
HTML_installer::showInstallMessage( $msg, 'Upload '.$element.' - Upload Error', |
HTML_installer::showInstallMessage( $msg, T_('Upload').' '.$element.' - '.T_('Upload Error'), |
| 117 |
$installer->returnTo( $option, $element, $client ) ); |
$installer->returnTo( $option, $element, $client ) ); |
| 118 |
} |
} |
| 119 |
} |
} |
| 126 |
$userfile = mosGetParam( $_REQUEST, 'userfile', '' ); |
$userfile = mosGetParam( $_REQUEST, 'userfile', '' ); |
| 127 |
|
|
| 128 |
if (!$userfile) { |
if (!$userfile) { |
| 129 |
mosRedirect( "index2.php?option=$option&element=module", "Please select a directory" ); |
mosRedirect( "index2.php?option=$option&element=module", T_("Please select a directory") ); |
| 130 |
} |
} |
| 131 |
|
|
| 132 |
$installer = new $installerClass(); |
$installer = new $installerClass(); |
| 137 |
} |
} |
| 138 |
|
|
| 139 |
$ret = $installer->install( $path ); |
$ret = $installer->install( $path ); |
| 140 |
HTML_installer::showInstallMessage( $installer->getError(), 'Upload new '.$element.' - '.($ret ? 'Success' : 'Error'), |
HTML_installer::showInstallMessage( $installer->getError(), T_('Upload new').' '.$element.' - '.($ret ? T_('Success') : T_('Error')), |
| 141 |
$installer->returnTo( $option, $element, $client ) ); |
$installer->returnTo( $option, $element, $client ) ); |
| 142 |
} |
} |
| 143 |
/** |
/** |
| 158 |
|
|
| 159 |
$msg = $installer->getError(); |
$msg = $installer->getError(); |
| 160 |
|
|
| 161 |
mosRedirect( $installer->returnTo( $option, $element, $client ), $result ? 'Success ' . $msg : 'Failed ' . $msg ); |
mosRedirect( $installer->returnTo( $option, $element, $client ), $result ? T_('Success').' ' . $msg : T_('Failed').' '. $msg ); |
| 162 |
} |
} |
| 163 |
/** |
/** |
| 164 |
* @param string The name of the php (temporary) uploaded file |
* @param string The name of the php (temporary) uploaded file |
| 175 |
if (mosChmod( $baseDir . $userfile_name )) { |
if (mosChmod( $baseDir . $userfile_name )) { |
| 176 |
return true; |
return true; |
| 177 |
} else { |
} else { |
| 178 |
$msg = 'Failed to change the permissions of the uploaded file.'; |
$msg = T_('Failed to change the permissions of the uploaded file.'); |
| 179 |
} |
} |
| 180 |
} else { |
} else { |
| 181 |
$msg = 'Failed to move uploaded file to <code>/media</code> directory.'; |
$msg = T_('Failed to move uploaded file to <code>/media</code> directory.'); |
| 182 |
} |
} |
| 183 |
} else { |
} else { |
| 184 |
$msg = 'Upload failed as <code>/media</code> directory is not writable.'; |
$msg = T_('Upload failed as <code>/media</code> directory is not writable.'); |
| 185 |
} |
} |
| 186 |
} else { |
} else { |
| 187 |
$msg = 'Upload failed as <code>/media</code> directory does not exist.'; |
$msg = T_('Upload failed as <code>/media</code> directory does not exist.'); |
| 188 |
} |
} |
| 189 |
return false; |
return false; |
| 190 |
} |
} |