本文整理汇总了PHP中main::canRun方法的典型用法代码示例。如果您正苦于以下问题:PHP main::canRun方法的具体用法?PHP main::canRun怎么用?PHP main::canRun使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类main
的用法示例。
在下文中一共展示了main::canRun方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: explode
if (THT != 1) {
die;
}
//This page is included from inside of a function.
global $dbh, $postvar, $getvar, $instance;
if (INSTALL == 1) {
if ($dbh->config("show_page_gentime") == 1) {
$mtime = explode(' ', microtime());
$totaltime = $mtime[0] + $mtime[1] - $starttime;
$gentime = substr($totaltime, 0, 5);
$page_generation_time_array['PAGEGEN'] = $gentime;
$page_generation_time_array['IP'] = getenv('REMOTE_ADDR');
$pagegen .= style::replaceVar('tpl/page-generation-time.tpl', $page_generation_time_array);
if ($dbh->config("show_footer")) {
$server_status_array['EXTRA'] = '';
if (!main::canRun('shell_exec')) {
$server_status_array['EXTRA'] = 'Some statistics could not be provided because shell_exec has been disabled.';
}
$server_status_array['OS'] = php_uname();
$server_status_array['DISTRO'] = '';
if (php_uname('s') == 'Linux') {
$distro = main::getLinuxDistro();
if ($distro) {
$server_status_array['DISTRO'] = '<tr><td><strong>Linux Distro:</strong></td><td> ' . $distro . ' </td></tr>';
}
}
$server_status_array['SOFTWARE'] = $_SERVER["SERVER_SOFTWARE"];
$server_status_array['PHP_VERSION'] = phpversion();
$server_status_array['MYSQL_VERSION'] = '';
$versionResult = $dbh->version();
if ($versionResult) {
示例2: content
//.........这里部分代码省略.........
echo "That server doesn't exist!";
} else {
if ($_POST) {
check::empty_fields();
if (!main::errors()) {
$servers_update = array("name" => $postvar['name'], "host" => $postvar['host'], "reseller_id" => $postvar['resellerid'], "user" => $postvar['user'], "pass" => $postvar['pass'], "accesshash" => $postvar['hash'], "port" => $postvar['port'], "resellerport" => $postvar['resellerport'], "nameservers" => $postvar['nameservers'], "ip" => $postvar['ip'], "dnstemplate" => $postvar['nstmp'], "welcome" => $postvar['welcome'], "https" => $postvar['https'], "apiport" => $postvar['apiport']);
$dbh->update("servers", $servers_update, array("id", "=", $getvar['do']), 1);
//Server edit complete
main::done();
}
}
$servers_data = $dbh->fetch_array($servers_query);
$serverfile = server::createServer(0, $servers_data['type']);
$server_fields = $serverfile->acp_form($getvar['do']);
$edit_server_array['NAME'] = $servers_data['name'];
$edit_server_array['HOST'] = $servers_data['host'];
$edit_server_array['SERVERIP'] = $servers_data['ip'];
$edit_server_array['RESELLERPORT'] = $servers_data['resellerport'];
$edit_server_array['PORT'] = $servers_data['port'];
$edit_server_array['NAMESERVERS'] = $servers_data['nameservers'];
$edit_server_array['SERVER_FIELDS'] = $server_fields;
echo style::replaceVar("tpl/admin/servers/edit-server.tpl", $edit_server_array);
}
} else {
$servers_query = $dbh->select("servers");
if ($dbh->num_rows($servers_query) == 0) {
echo "There are no servers to view!";
} else {
echo "<ERRORS>";
while ($servers_data = $dbh->fetch_array($servers_query)) {
echo main::sub("<strong>" . $servers_data['name'] . "</strong>", '<a href="?page=servers&sub=view&do=' . $servers_data['id'] . '"><img src="' . URL . 'themes/icons/magnifier.png"></a>');
}
}
}
break;
case "delete":
if ($getvar['do']) {
$dbh->delete("servers", array("id", "=", $getvar['do']));
main::errors("Server Deleted!");
}
$servers_query = $dbh->select("servers");
if ($dbh->num_rows($servers_query) == 0) {
echo "There are no servers to delete!";
} else {
echo "<ERRORS>";
while ($servers_data = $dbh->fetch_array($servers_query)) {
echo main::sub("<strong>" . $servers_data['name'] . "</strong>", '<a href="?page=servers&sub=delete&do=' . $servers_data['id'] . '"><img src="' . URL . 'themes/icons/delete.png"></a>');
}
}
break;
case "test":
if (isset($getvar["do"])) {
$result = server::testConnection($getvar["do"]);
if ($result === true) {
echo '<div style="text-align:center;padding-top:10px;">' . style::notice(true, "Connected to the server successfully!") . "</div>";
} else {
echo '<div style="text-align:center;">' . style::notice(false, "Couldn't connect to the server...") . "</div>";
echo '<strong>Error:</strong><pre>' . (string) $result . '</pre>';
}
} else {
$servers_query = $dbh->select("servers");
if ($dbh->num_rows($servers_query) == 0) {
echo "There are no servers to view!";
} else {
echo "Caution: Some servers are set to automatically ban the IP address of this server (" . $_SERVER['SERVER_ADDR'] . ") after a certain number of failed logins.<br />";
while ($servers_data = $dbh->fetch_array($servers_query)) {
echo main::sub("<strong>" . $servers_data['name'] . "</strong>", '<a href="?page=servers&sub=test&do=' . $servers_data['id'] . '"><img src="' . URL . 'themes/icons/server_chart.png"></a>');
}
}
}
break;
case "status":
$server_status_array['EXTRA'] = '';
if (!main::canRun('shell_exec')) {
$server_status_array['EXTRA'] = 'Some statistics could not be provided because shell_exec has been disabled.<br>';
}
$server = $_SERVER['HTTP_HOST'];
$server_status_array['OS'] = php_uname();
$server_status_array['DISTRO'] = '';
if (php_uname('s') == 'Linux') {
$distro = main::getLinuxDistro();
if ($distro) {
$server_status_array['DISTRO'] = '<tr><td><strong>Linux Distro:</strong></td><td> ' . $distro . ' </td></tr>';
}
}
$server_status_array['SOFTWARE'] = getenv('SERVER_SOFTWARE');
$server_status_array['PHP_VERSION'] = phpversion();
$server_status_array['MYSQL_VERSION'] = '';
$mysqlVersion = $dbh->version();
if ($mysqlVersion) {
$server_status_array['MYSQL_VERSION'] = '<tr><td><strong>MySQL Version:</strong><br><br></td><td> ' . $mysqlVersion . ' <br><br></td></tr>';
}
$server_status_array['SERVER'] = $server;
echo style::replaceVar('tpl/admin/servers/server-status.tpl', $server_status_array);
break;
case "phpinfo":
echo server::show_phpinfo();
break;
}
}