<?php // calculate disk space $thisDir = dirname(__FILE__); $totalBytes = @disk_total_space($thisDir); $freeBytes = @disk_free_space($thisDir); // get ulimit limits list($maxCpuSeconds, $memoryLimitKbytes, $maxProcessLimit, $ulimitOutput) = getUlimitValues('soft'); if ($maxCpuSeconds == '') { $maxCpuSeconds_formatted = t('none'); } elseif ($maxCpuSeconds == 'unlimited') { $maxCpuSeconds_formatted = t('unlimited'); } else { $maxCpuSeconds_formatted = "{$maxCpuSeconds} " . t('seconds'); } if ($memoryLimitKbytes == '') { $memoryLimit_formatted = t('none'); } elseif ($memoryLimitKbytes == 'unlimited') { $memoryLimit_formatted = t('unlimited'); } else { $memoryLimit_formatted = formatBytes($memoryLimitKbytes * 1024); } $ulimitLink = "?menu=admin&action=ulimit"; // Show Upcoming Version Warning $currentPhpVersion = phpversion(); $currentMySqlVersion = preg_replace("/[^0-9\\.]/", '', mysql_get_server_info()); if (time() > strtotime('2016-06-20')) { $nextPhpRequired = '5.6'; } elseif (time() > strtotime('2015-09-14')) { $nextPhpRequired = '5.5'; } else {
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'); } }