Esempio n. 1
0
 function setupOpenOfficeOrg()
 {
     if (!$this->allowedAdminAccess) {
         return;
     }
     $hideOpenOfficeOrgOption = getGlobalConfigItem('hideAdminOptionOpenOfficeOrg');
     if ($hideOpenOfficeOrgOption == "true") {
         return;
     }
     $numberOfOpenOfficeBasedConvertersFound = 0;
     $openOfficeBasedConverters = array('openofficeorg', 'jodconverter', 'pyodconverter');
     foreach ($this->converters as $converterId => $converterName) {
         if (!in_array($converterId, $openOfficeBasedConverters)) {
             continue;
         }
         $hideConverter = getGlobalConfigItem('hideAdminOption' . $converterId);
         if ($hideConverter == 'true') {
             $numberOfOpenOfficeBasedConvertersFound++;
         }
     }
     if ($numberOfOpenOfficeBasedConvertersFound == count($openOfficeBasedConverters)) {
         return;
     }
     $docvertDir = dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR;
     $docvertWritableDir = getWritableDirectory();
     $template = $this->getThemeFragment('admin-setupopenofficeorg.htmlf');
     $toggleStatus = '';
     include_once dirname(__FILE__) . '/config.php';
     if (DIRECTORY_SEPARATOR == '/') {
         $disallowXVFB = getGlobalConfigItem('disallowXVFB');
         if (isset($_POST['startOpenOfficeOrgServerLinux'])) {
             $shellCommandTemplate = '{{elevate-privledges}} {{bash-script}} {{xvfb}}';
             $xvfbCommand = '';
             $elevatePrivledges = '';
             if ($disallowXVFB) {
                 $xvfbCommand = 'true';
             }
             $shellCommandTemplate = str_replace('{{xvfb}}', $xvfbCommand, $shellCommandTemplate);
             $shellCommandTemplate = str_replace('{{elevate-privledges}}', $elevatePrivledges, $shellCommandTemplate);
             $output = shellCommand($shellCommandTemplate, 3);
             include_once dirname(__FILE__) . '/lib.php';
             $diagnostics = suggestFixesToCommandLineErrorMessage($output, array(), false);
             if ($diagnostics) {
                 $diagnostics .= '<div style="background:#ffff99;border: solid 1px #ffff99;"><h1 style="font-size:small;padding-left:1%;color:red">Diagnostics</h1> <p>There were problems opening up JODConverter OpenOffice.org Server</p><p>I ran this command,</p><blockquote><tt>' . $shellCommandTemplate . '</tt></blockquote><p>But I don\'t think I was able to start OpenOffice.org because the script returned.</p><blockquote><tt>' . $output . '</tt></blockquote>' . $diagnostics . '</div>';
                 $toggleStatus = $diagnostics . $toggleStatus;
             }
         }
     }
     $template = str_replace('{{toggle}}', $toggleStatus, $template);
     return $template;
 }
Esempio n. 2
0
/**
 * Start OpenOfficeOrg on the desktop in order to let the user configure it.
 * Not to be called remotely -- this actually starts it up on their desktop.
 */
function setupOpenOfficeOrg()
{
    set_time_limit(60 * 2);
    include_once dirname(__FILE__) . '/security.php';
    $adminPassword = Security::getAdminPassword();
    if ($adminPassword === null) {
        webServiceError('&error-refusing-to-start-ooo-password;', 300);
    } else {
        session_start();
        if (Security::hashPassword($_SESSION['docvert_p']) != $adminPassword) {
            webServiceError('&error-refusing-to-start-ooo-lack-of-password;', 300);
        }
    }
    $output = makeOasisOpenDocument(null, 'openofficeorg', true);
    $body = null;
    $body .= '&setup-openofficeorg-title;';
    $suggestedFixes = '';
    if (trim($output) != '') {
        $suggestedFixes = suggestFixesToCommandLineErrorMessage($output, null, false);
    }
    if (trim($suggestedFixes) != '') {
        $body .= '&setup-openofficeorg-failed;<blockquote><tt>' . revealXml($output) . '</tt></blockquote>';
        webServiceError($body . $suggestedFixes);
    } else {
        webServiceError('&setup-openofficeorg-success;', 200);
    }
}