////    HANDLE FILE UPLOAD AND PROCESSING
$errors = array();
$uploadResult = '';
if (isset($_REQUEST['languagePackAction']) && !empty($_REQUEST['languagePackAction'])) {
    switch ($_REQUEST['languagePackAction']) {
        case 'upload':
            $file = new UploadFile('language_pack');
            if ($file->confirm_upload()) {
                // check for a real file
                // cn: bug 9072 - apache sometimes detects zip as binary MIME type
                if (strpos($file->mime_type, 'binary') && strtolower($file->file_ext) == 'zip' || strpos($file->mime_type, 'zip') !== false) {
                    // only .zip files
                    if (langPackFinalMove($file)) {
                        // move file to sugar upload_dir
                        $uploadResult = $mod_strings['LBL_LANG_SUCCESS'];
                        $result = langPackUnpack();
                    } else {
                        $errors[] = $mod_strings['ERR_LANG_UPLOAD_3'];
                    }
                } else {
                    $errors[] = $mod_strings['ERR_LANG_UPLOAD_2'];
                }
            } else {
                $errors[] = $mod_strings['ERR_LANG_UPLOAD_1'];
            }
            if (count($errors) > 0) {
                foreach ($errors as $error) {
                    $uploadResult .= $error . "<br />";
                }
            }
            break;
Esempio n. 2
0
             if (strpos($file->mime_type, 'zip') !== false) {
                 // only .zip files
                 if (langPackFinalMove($file)) {
                     $perform = true;
                 } else {
                     $errors[] = $mod_strings['ERR_LANG_UPLOAD_3'];
                 }
             } else {
                 $errors[] = $mod_strings['ERR_LANG_UPLOAD_2'];
             }
         }
     }
     if ($perform) {
         // check for a real file
         $uploadResult = $mod_strings['LBL_LANG_SUCCESS'];
         $result = langPackUnpack('langpack', $tempFile);
     } else {
         $errors[] = $mod_strings['ERR_LANG_UPLOAD_1'];
     }
     if (count($errors) > 0) {
         foreach ($errors as $error) {
             $uploadResult .= $error . "<br />";
         }
     }
     break;
     // end 'validate'
 // end 'validate'
 case 'commit':
     $sugar_config = commitModules(false, 'langpack');
     break;
 case 'uninstall':
Esempio n. 3
0
         }
         if (strpos($file->mime_type, 'zip') !== false) {
             // only .zip files
             if (langPackFinalMove($file)) {
                 $perform = true;
             } else {
                 $errors[] = $mod_strings['ERR_LANG_UPLOAD_3'];
             }
         } else {
             $errors[] = $mod_strings['ERR_LANG_UPLOAD_2'];
         }
     }
     if ($perform) {
         // check for a real file
         $uploadResult = $mod_strings['LBL_LANG_SUCCESS'];
         $result = langPackUnpack('patch', $tempFile);
     } else {
         $errors[] = $mod_strings['ERR_LANG_UPLOAD_1'];
     }
     if (count($errors) > 0) {
         foreach ($errors as $error) {
             $uploadResult .= $error . "<br />";
         }
     }
     break;
     // end 'validate'
 // end 'validate'
 case 'commit':
     $sugar_config = commitPatch();
     break;
 case 'remove':