Exemplo n.º 1
0
// map the element to the required derived class
$classMap = array('universal' => 'mosInstaller', 'component' => 'mosInstaller', 'language' => 'mosInstaller', 'mambot' => 'mosInstaller', 'module' => 'mosInstaller', 'template' => 'mosInstaller', 'include' => 'mosInstaller', 'parameters' => 'mosInstaller');
if (array_key_exists($element, $classMap)) {
    //	require_once( $mainframe->getPath( 'installer_class', $element ) );
    switch ($task) {
        case 'uploadfile':
            uploadPackage($classMap[$element], $option, $element, $client);
            break;
        case 'installfromdir':
            installFromDirectory($classMap[$element], $option, $element, $client);
            break;
        case 'installfromurl':
            installFromUrl($classMap[$element], $option, $element, $client);
            break;
        case 'thesource':
            HTML_installer::theSourceForm($option, $element, $client);
            break;
        case 'addon':
            HTML_installer::AddonForm($classMap[$element], $option, $element, $client);
            break;
        case 'remove':
            $uninstaller = $element . '_uninstall';
            if (is_callable($uninstaller)) {
                $cid = mosGetParam($_REQUEST, 'cid', array(0));
                if (is_array($cid) and isset($cid[0])) {
                    $uninstaller($cid[0], $option, $client);
                    exit;
                }
                mosRedirect(returnTo($option, $element, $client), T_('There was nothing selected to be uninstalled'));
            } else {
                mosRedirect(returnTo($option, $element, $client), T_('Uninstaller not found for element [%s]'));