Files
2026-07-19 18:27:27 +08:00

83 lines
3.0 KiB
PHP

<?php
// Load the language support
require_once('../config/language.php');
//Load the Pi-Star Release file
$pistarReleaseConfig = '/etc/pistar-release';
$configPistarRelease = array();
$configPistarRelease = parse_ini_file($pistarReleaseConfig, true);
//Load the Version Info
require_once('../config/version.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" lang="en">
<head>
<meta name="robots" content="index" />
<meta name="robots" content="follow" />
<meta name="language" content="English" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="Author" content="Andrew Taylor (MW0MWZ)" />
<meta name="Description" content="CDN Expert Editor" />
<meta name="KeyWords" content="CDN" />
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="pragma" content="no-cache" />
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">
<meta http-equiv="Expires" content="0" />
<title>CDN - Digital Voice Dashboard - Expert Editor</title>
<link rel="stylesheet" type="text/css" href="../css/pistar-css.php" />
</head>
<body>
<div class="container">
<?php include './header-menu.inc'; ?>
<div class="contentwide">
<?php
if(isset($_POST['data'])) {
// File Wrangling
exec('sudo cp /etc/crontab /tmp/a8h4d8n3c83h4.tmp');
exec('sudo chown www-data:www-data /tmp/a8h4d8n3c83h4.tmp');
exec('sudo chmod 664 /tmp/a8h4d8n3c83h4.tmp');
// Open the file and write the data
$filepath = '/tmp/a8h4d8n3c83h4.tmp';
$fh = fopen($filepath, 'w');
fwrite($fh, str_replace("\r", "", $_POST['data']));
fclose($fh);
exec('sudo mount -o remount,rw /');
exec('sudo cp /tmp/a8h4d8n3c83h4.tmp /etc/crontab');
exec('sudo chmod 644 /etc/crontab');
exec('sudo chown root:root /etc/crontab');
exec('sudo mount -o remount,ro /');
// Re-open the file and read it
$fh = fopen($filepath, 'r');
$theData = fread($fh, filesize($filepath));
} else {
// File Wrangling
exec('sudo cp /etc/crontab /tmp/a8h4d8n3c83h4.tmp');
exec('sudo chown www-data:www-data /tmp/a8h4d8n3c83h4.tmp');
exec('sudo chmod 664 /tmp/a8h4d8n3c83h4.tmp');
// Open the file and read it
$filepath = '/tmp/a8h4d8n3c83h4.tmp';
$fh = fopen($filepath, 'r');
$theData = fread($fh, filesize($filepath));
}
fclose($fh);
?>
<h2>System Cron (Full Edit)</h2>
<div class="settings-card" style="padding-top:16px;">
<form name="test" method="post" action="">
<textarea class="raw-editor" name="data"><?php echo $theData; ?></textarea><br />
<div class="field-actions"><input type="submit" name="submit" value="<?php echo $lang['apply']; ?>" /></div>
</form>
</div>
</div>
</div>
</body>
</html>