<ol type="A">
      <li>Your database settings are incorrect (check in /data/<?php 
echo SETTINGS_FILENAME;
?>
)</li>
      <li>Your database server is down or overloaded (check with your host)</li>
    </ol>

    <p>The database error given was:<br/>
    <?php 
echo @$connectionError ? $connectionError : 'none';
?>


   </dd>
  </dl>


  </div>
</div>


<div style="text-align: center; font-size: 8px; color: #666666">
  <?php 
printf(t("%s seconds"), showExecuteSeconds());
?>
</div>

</body>
</html>
Esempio n. 2
0
function _init_showInternetConnectivityErrors($hostname = 'www.google.com', $port = 80)
{
    // use google for testing as it should always be available worldwide
    ### set vars and do connection test
    $ipOrHostname = gethostbyname($hostname);
    // returns IP or passed hostname if IP lookup failed
    $resolvedIp = $ipOrHostname == $hostname ? '' : $ipOrHostname;
    $connectToDomain = @fsockopen("tcp://{$hostname}", $port, $hostErrno, $hostErrstr, 2);
    $connectToIpv4 = $resolvedIp ? @fsockopen("tcp://{$ipOrHostname}", $port, $ipErrno, $ipErrstr, 2) : false;
    $fsockopenDisabled = preg_match('/fsockopen/i', ini_get('disable_functions'));
    $outboundConnectionsWorking = $resolvedIp && $connectToDomain && $connectToIpv4;
    ### shell commands
    $hostnameAndPort = $hostname . ($port && $port != 80 ? ":{$port}" : '');
    // add :port if it's defined and not 80
    $wgetCommand = "wget --spider -T2 -O- http://{$hostnameAndPort}/ 2>&1";
    // wget docs: http://www.gnu.org/software/wget/manual/wget.html
    // --spider                    // don't download pages, just check if they are there
    // -T2 or --timeout=2          // timeout after X seconds on DNS, connect, or read (independently)
    // -O- or --output-document=-  // output to STDOUT, needed so wget 1.12 won't save a file on second GET request after first HEAD request gets a 501
    // -d  or --debug              // (not used - add for debugging) Show debugging info such as HTTP request and response headers, and more detailed wget data
    $curlCommand = "curl --head -v -m2 http://{$hostnameAndPort}/ 2>&1";
    // curl docs: http://curl.haxx.se/docs/manpage.html
    // -I  or --head               // send HTTP HEAD request only (instead of get)
    // -v  or --verbose            // Show request and response headers and debug data
    // -m2 or --max-time 2         // timeout after max-time seconds (for whole operation)
    // -N  or --no-buffer          // (not used) disable output buffering
    // -s  or --silent             // (not used) Don't show progress meter or error messages.
    // -S  or --show-error         // (not used) When used with -s it makes curl show an error message if it fails.
    // -i  or --include            // (not used) Show HTTP headers received
    ### wget|curl debug output
    if (!$outboundConnectionsWorking && (@$_REQUEST['wget'] || @$_REQUEST['curl'])) {
        $command = @$_REQUEST['curl'] ? $curlCommand : $wgetCommand;
        header("Content-type: text/plain");
        print "Executing command: {$command}\n\n";
        print `{$command}`;
        print "\nDone, " . showExecuteSeconds(true) . " seconds";
        exit;
    }
    // default error message
    if (!$outboundConnectionsWorking) {
        if ($hostname == 'www.google.com') {
            $errors = "Error: Outbound internet connections from this server are not working.<br/>\n";
        } else {
            $errors = "Error: Internet connections from this server to '{$hostname}' are not working.<br/>\n";
        }
        $errors .= "Please ask your system administrator to enable network connectivity for PHP and/or resolve this issue.<br/><br/>\n";
        $errors .= "Technical details for system administrators:<br/>\n";
        $errors .= "<ul>\n";
        if (!$resolvedIp) {
            $errors .= "<li>Unable to resolve IP address for test domain '{$hostname}' - Check DNS</li>";
        }
        if (!$connectToDomain) {
            $errors .= "<li>Unable to connect to test domain '{$hostname}' (Error #" . @$hostErrno . " - " . @$hostErrstr . ") - Check Firewall</li>";
        }
        if (!$connectToDomain && $connectToIpv4) {
            $errors .= "<li>Unable to connect to test domain '{$hostname}' but able to resolve and connect to IPv4 ({$resolvedIp}) for domain - Check IPv6 config</li>";
        }
        if ($fsockopenDisabled) {
            $errors .= "<li>fsockopen appears in list of disabled php functions 'disable_functions' - Check php.ini or httpd.conf";
            $errors .= "<ul>\n";
            $errors .= "<li>Loaded php.ini: " . php_ini_loaded_file() . "\n";
            $errors .= "<li>disable_function: " . get_cfg_var("disable_functions") . "\n";
            $errors .= "</ul></li>\n";
        }
        // debug utilities
        $errors .= "<li>Debugging - check resolved addresses and connection status with:\n";
        $errors .= "<ul>\n";
        $errors .= "<li><a href='?wget=1'>{$wgetCommand}</a></li>\n";
        $errors .= "<li><a href='?curl=1'>{$curlCommand}</a></li>\n";
        $errors .= "</ul></li>\n";
        $errors .= "</ul>\n";
        die($errors);
    }
}
Esempio n. 3
0
  <div id="footer">
    <small>
    <?php 
if ($SETTINGS['footerHTML']) {
    echo getEvalOutput($SETTINGS['footerHTML']) . '<br/>';
}
$executeSecondsString = sprintf(t("%s seconds"), showExecuteSeconds(true));
echo applyFilters('execute_seconds', $executeSecondsString);
?>

    <?php 
doAction('admin_footer');
?>
    <!-- -->
    </small>
  </div>

</div> <!-- End #main-content -->
</div> <!-- End #body-wrapper -->

<div class="clear"></div>

</body>
</html>
Esempio n. 4
0
    print "php -q {$thisScriptPath}\n\n";
    print "CHECKING TASKS\n";
    print "-------------------------------------------------------------------------------\n";
    print "Please don't close this browser until the page is finished loading.\n";
    print "Task output and updates can be found under the Admin Menu.\n\n";
}
// error checking
if (!isInstalled()) {
    die("You must install the software before the cron script can dispatch tasks!");
}
// Dispatch cron jobs (aka: background tasks, scheduled tasks)
cron_dispatcher();
//
if (!inCLI()) {
    print "\n-------------------------------------------------------------------------------\n";
    print "Done, total time " . showExecuteSeconds(true) . " seconds.\n";
}
exit;
// cron_dispatcher() - run all cron jobs that:
// - were scheduled to run now or since since cron.php last executed
// - haven't run since cron.php last executed
// Note: This means even if cron.php is delayed, it will always run your cronjob, but not more than once per each execution of cron.php.
/*

// Add CronJob Example
// minute(0-59), hour(0-23), dayOfMonth(1-31), month(1-12), dayOfWeek(0-7, 0=Sunday)
// Supports: *(any/all), 6(numbers), 1-3(ranges), 15,30,45(number lists)
// ****NOTE: Cronjob functions should return any content they want added to the log as the "Summary" and print/echo any content
// ... they wanted displayed as "output" textbox
addCronJob('my_function1', '5 * * * *');  // Run every 5 minutes
addCronJob('my_function2', '0 1 * * 0');  // Run at 1am every Sunday Night
Esempio n. 5
0
function showBuildInfo()
{
    global $APP, $SETTINGS;
    # NOTE: Disabling or modifying licensing or registration code violates your license agreement and is willful copyright infringement.
    # NOTE: Copyright infringement can be very expensive: http://en.wikipedia.org/wiki/Statutory_damages_for_copyright_infringement
    # NOTE: Please do not steal our software.
    // display build info
    echo "\n<!--\n";
    if (isset($_SERVER['QUERY_STRING']) && sha1($_SERVER['QUERY_STRING']) == '3831b0376dab413292f03dd30523e749bdd3279e') {
        $buildId = join('.', array($APP['build'], $APP['id'], isValidProductId($SETTINGS['licenseProductId'])));
        echo "{$SETTINGS['programName']} v{$APP['version']} (Build: {$buildId})\n";
        echo "Licensed to: {$SETTINGS['licenseCompanyName']} ~ {$SETTINGS['licenseDomainName']}\n";
    }
    echo "Execute time: " . showExecuteSeconds('return') . " seconds\n";
    echo "-->\n";
}
function admin_dispatchAction($action)
{
    if ($action == 'general') {
        showInterface('admin/general.php');
    } elseif ($action == 'adminSave') {
        admin_saveSettings('admin/general.php');
    } elseif ($action == 'vendor') {
        showInterface('admin/vendor.php');
    } elseif ($action == 'vendorSave') {
        admin_saveSettings('admin/vendor.php');
    } elseif ($action == 'phpinfo') {
        disableInDemoMode('', 'admin/general.php');
        phpinfo();
        print "<h2>get_loaded_extensions()</h2>\n" . implode("<br/>\n", get_loaded_extensions()) . "\n";
        if (function_exists('apache_get_modules')) {
            print "<h2>apache_get_modules()</h2>\n" . implode("<br/>\n", apache_get_modules()) . "\n";
        }
        print "<h2>get_defined_constants()</h2>\n<xmp>" . print_r(get_defined_constants(), true) . "</xmp>\n";
        //
        $mbInfo = mb_get_info();
        ksort($mbInfo);
        print "<h2>mb_get_info()</h2>\n<xmp>" . print_r($mbInfo, true) . "</xmp>\n";
        exit;
    } elseif ($action == 'ulimit') {
        disableInDemoMode('', 'admin/general.php');
        print "<h2>Soft Resource Limits (ulimit -a -S)</h2>\n";
        list($maxCpuSeconds, $memoryLimitKbytes, $maxProcessLimit, $ulimitOutput) = getUlimitValues('soft');
        showme($ulimitOutput);
        print "<h2>Hard Resource Limits (ulimit -a -H)</h2>\n";
        list($maxCpuSeconds, $memoryLimitKbytes, $maxProcessLimit, $ulimitOutput) = getUlimitValues('soft');
        showme($ulimitOutput);
        exit;
    } elseif ($action == 'updateDate') {
        getAjaxDate();
    } elseif ($action == 'getUploadPathPreview') {
        getUploadPathPreview(@$_REQUEST['dirOrUrl'], @$_REQUEST['inputValue'], @$_REQUEST['isCustomField'], true);
    } elseif ($action == 'plugins') {
        // allow disabling plugins
        if (file_exists("{$GLOBALS['PROGRAM_DIR']}/plugins/_disable_all_plugins.txt")) {
            alert('Development Mode: Plugins are disabled.  Remove or rename /plugins/_disable_all_plugins.txt to enable.<br/>');
        } else {
        }
        showInterface('admin/plugins.php');
    } elseif ($action == 'pluginHooks') {
        showInterface('admin/pluginHooks.php');
    } elseif ($action == 'deactivatePlugin') {
        security_dieUnlessPostForm();
        security_dieUnlessInternalReferer();
        security_dieOnInvalidCsrfToken();
        disableInDemoMode('plugins', 'admin/plugins.php');
        deactivatePlugin(@$_REQUEST['file']);
        redirectBrowserToURL('?menu=admin&action=plugins', true);
        exit;
    } elseif ($action == 'activatePlugin') {
        security_dieUnlessPostForm();
        security_dieUnlessInternalReferer();
        security_dieOnInvalidCsrfToken();
        disableInDemoMode('plugins', 'admin/plugins.php');
        activatePlugin(@$_REQUEST['file']);
        redirectBrowserToURL('?menu=admin&action=plugins', true);
        exit;
    } elseif ($action == 'backup') {
        security_dieUnlessPostForm();
        security_dieUnlessInternalReferer();
        security_dieOnInvalidCsrfToken();
        disableInDemoMode('', 'admin/general.php');
        $filename = backupDatabase(null, @$_REQUEST['backupTable']);
        notice(sprintf(t('Created backup file %1$s (%2$s seconds)'), $filename, showExecuteSeconds(true)));
        showInterface('admin/general.php');
        exit;
    } elseif ($action == 'restore') {
        security_dieUnlessPostForm();
        security_dieUnlessInternalReferer();
        security_dieOnInvalidCsrfToken();
        disableInDemoMode('', 'admin/general.php');
        $filename = @$_REQUEST['file'];
        restoreDatabase(DATA_DIR . '/backups/' . $filename);
        notice("Restored backup file /data/backups/{$filename}");
        makeAllUploadRecordsRelative();
        showInterface('admin/general.php');
        exit;
    } elseif ($action == 'bgtasksLogsClear') {
        security_dieUnlessPostForm();
        security_dieUnlessInternalReferer();
        security_dieOnInvalidCsrfToken();
        disableInDemoMode('', 'admin/general.php');
        mysql_delete('_cron_log', null, 'true');
        notice(t("Background Task logs have been cleared."));
        showInterface('admin/general.php');
        exit;
    } else {
        showInterface('admin/general.php');
    }
}