Buonasera,
ho il seguente problema con uno script (visualizzatore della fase lunare) che da quando utilizzo la versione di PHP 7.3.1 non viene più visualizzato,
lo script in php è composto da due file index.php e admin.php e chiedo se è ancora possibile aggiornare il codice per renderlo utilizzabile.
Grazie per l'attenzione.
Riccardo
-------------------------
file index.php
<?
/*
CMSimple SMCal plugin
© 2006 - Joachim Barthel - www.qualifire.de/cmsimple/en
---------------------------------------------------------------------
Disclaimer: No warranties at all, use on your own risk !
---------------------------------------------------------------------
Requirements: - CMSimple 2.5 is installed and running.
- The plugin loader from cmsimpleplugins.svarrer.dk
is installed and working !
-or-
- The plugin loader, version 2.0 beta 9 from
internet-setup.de/abdj_download/index.php is installed and working!
---------------------------------------------------------------------
Feedback to: jbarthel@qualifire.de
---------------------------------------------------------------------
Version 0.1 beta (03. June 2007)
- portation of original calendar from www.jagdundwild.de
- sunrise and sunset times added
- css support for table layout
- language support for DE, EN, FR
- support of daylight savings
- german and english help
*/
function smc_Version() {
return "0.1 beta";
}
function smc_table() {
GLOBAL $sn, $su, $sl, $plugin_cf, $plugin_tx, $pth, $plugin;
error_reporting(E_ALL);
$smo = "";
$smo .= "<!-- QualiFIREs SunMoonCalendar >>SMCal<< Code starts here -->\n<div><br>\n";
$smo .= MoonCal(date("n"),date("Y"));
if(eregi("true",$plugin_cf['smcal']['show_creator'])) {
$smo .= "<div style=\"text-align: center; font-size: 0.75em; display: block\">";
} else {
$smo .= "<div style=\"text-align: center; font-size: 0.75em; display: none\">";
}
$smo .= "<br> <br><span style=\"border-top: 1px solid; padding-top: 2px; color:#666666;\"> Sun & Moon Calendar plugin, Ver. " . smc_version() . " by <a href=\"http://www.qualifire.de/cmsimple\" target=\"_blank\">QualiFIRE</a> </span>";
$smo .= "</div>";
$smo .= "<br></div>";
$smo .= "\n<!-- QualiFIREs SunMoonCalendar >>SMCal<< Code ends here -->\n";
return $smo;
}
function MoonCal($monat,$jahr) {
GLOBAL $sn, $su, $sl, $plugin_cf, $plugin_tx, $pth, $plugin;
error_reporting(E_ALL ^ E_NOTICE);
$t_monat = isset($_POST['month']) ? $_POST['month'] : $_GET['month'];
if (!empty($t_monat)) $monat = $t_monat;
$t_jahr = isset($_POST['year']) ? $_POST['year'] : $_GET['year'];
if (!empty($t_jahr)) $jahr = $t_jahr;
error_reporting(E_ALL);
$WeekDays = split(",",$plugin_tx['smcal']['txt_weekdays']);
$t = "";
$t .= "<div class=\"smcTableHeader\">" . $plugin_tx['smcal']['txt_location'] . ": " . $plugin_cf['smcal']['location_name'] . "</div>";
$t .= "<TABLE cellspacing=\"1\" cellpadding=\"1\" border=\"0\" class=\"smcTable\">";
for($n=1; $n<=46; $n++) {
$tag = mktime(0, 0, 0, $monat, $n, $jahr);
if (date("d",$tag) == "01") {
$t .= "<TR><TD align=\"center\" colspan=\"2\" class=\"smcMonthcell\">";
$t .= monatsnamen(date("n",$tag),$jahr);
$t .= "</TD></TR>";
}
$DayInfo = getdate($tag);
$WeekDay = $DayInfo["wday"];
if (($WeekDay == 6) || ($WeekDay == 0)) {
//$cellColor = "#9CB05E";
$cellClass = "smcWeekend";
} else {
//$cellColor = "White";
$cellClass = "smcWeekday";
}
$t .= "<TR><TD class=\"$cellClass\">";
$t .= " $WeekDays[$WeekDay] ";
$ctag = date($plugin_cf['smcal']['date_format'], $tag);
$anztage = intval( $tag / 86400 ) + 25570;
$t .= "$ctag </TD><TD class=\"$cellClass\">";
if ( date("I",mktime(6, 0, 0, $monat, $n, $jahr)) == "1" ) {
$tPlus = 2;
} else {
$tPlus = 1;
}
$t .= "<table cellpadding=\"0\" cellspacing=\"0\"><tr>";
if (phpversion() >= "5") {
$t .= "<td>";
$t .= "<small> ".$plugin_tx['smcal']['txt_sunrise']." ";
$fLatitude = doubleval($plugin_cf['smcal']['location_latitude']);
$fLongitude = doubleval($plugin_cf['smcal']['location_longitude']);
$fZenith = doubleval($plugin_cf['smcal']['sun_zenith']);
$t .= date_sunrise(mktime(0, 0, 0, $monat, $n, $jahr), SUNFUNCS_RET_STRING, $fLatitude, $fLongitude, $fZenith, $tPlus);
$t .= "<BR>";
$t .= " ".$plugin_tx['smcal']['txt_sunset']." ";
$t .= date_sunset(mktime(0, 0, 0, $monat, $n, $jahr), SUNFUNCS_RET_STRING, $fLatitude, $fLongitude, $fZenith, $tPlus);
$t .= "</small>";
$t .= "</td>";
}
$t .= "<td> </td><td>";
$t .= calcMoonphase($anztage);
$anztage = $anztage + 0.25;
$t .= calcMoonphase($anztage);
$anztage = $anztage + 0.25;
$t .= calcMoonphase($anztage);
$anztage = $anztage + 0.25;
$t .= calcMoonphase($anztage);
$t .= " ";
$t .= "</td></tr></table>";
$t .= "</TD></TR>";
}
$t .= "</TABLE>";
return $t;
}
function calcMoonphase ($tage) {
GLOBAL $sn, $su, $sl, $plugin_cf, $plugin_tx, $pth, $plugin;
$imgpath = $pth['folder']['plugins']."smcal/images/";
$prevphase = ($tage-0.25) / 29.530589 + 0.9291176;
$prevphase = $prevphase - intval($prevphase);
if ($prevphase < 0.5)
$prevphase = $prevphase * 2;
else
$prevphase = (1 - $prevphase) * 2;
$phase = $tage / 29.530589 + 0.9291176;
$phase = $phase - intval($phase);
if ($phase < 0.5)
$phase = $phase * 2;
else
$phase = (1 - $phase) * 2;
$nextphase = ($tage+0.25) / 29.530589 + 0.9291176;
$nextphase = $nextphase - intval($nextphase);
if ($nextphase < 0.5)
$nextphase = $nextphase * 2;
else
$nextphase = (1 - $nextphase) * 2;
$moonMode = "";
if (($prevphase < $phase) && ($phase > $nextphase))
$moonMode = " <IMG src=\"$imgpath/fullmoon.png\" height=\"15\" width=\"15\"> ".$plugin_tx['smcal']['txt_fullmoon']." ";
if (($prevphase > $phase) && ($phase < $nextphase))
$moonMode = " <IMG src=\"$imgpath/newmoon.png\" height=\"15\" width=\"15\"> ".$plugin_tx['smcal']['txt_newmoon']." ";
$diff1 = abs($prevphase - 0.5);
$diff2 = abs($phase - 0.5);
$diff3 = abs($nextphase - 0.5);
if (($diff2 < $diff1) && ($diff2 < $diff3)) {
if ($prevphase < $phase) {
$moonMode = "<IMG src=\"$imgpath/waxmoon.png\" height=\"15\" width=\"15\"> ".$plugin_tx['smcal']['txt_waxmoon']." ";
} else {
$moonMode = " <IMG src=\"$imgpath/descmoon.png\" height=\"15\" width=\"15\">".$plugin_tx['smcal']['txt_descmoon']." ";
}
}
return $moonMode;
}
function monatsnamen($monat, $jahr) {
GLOBAL $sn, $su, $sl, $plugin_cf, $plugin_tx, $pth, $plugin;
$monatNamen = split(",",$plugin_tx['smcal']['txt_monthnames']);
return $monatNamen[$monat-1] . " ". $jahr;
}
?>
-----------------
admin.php
<?php
if(isset($smcal))
{
GLOBAL $pth, $sl, $plugin;
$admin= isset($_POST['admin']) ? $_POST['admin'] : $_GET['admin'];
$action= isset($_POST['action']) ? $_POST['action'] : $_GET['action'];
$subaction= isset($_POST['subaction']) ? $_POST['subaction'] : $_GET['subaction'];
$plugin=basename(dirname(__FILE__),"/");
$o.=print_plugin_admin('off');
if($admin<>'plugin_main'){$o.=plugin_admin_common( $action,$admin,$plugin);}
if($admin=='')$o.="<h4>Sun & Moon Calendar</h4>Sun & Moon Calendar plugin ver 0.1 beta 0 by <a href=\"www.qualifire.de/cmsimple/\" target=\"_blank\">www.qualifire.de/cmsimple/</a>";
/*
if ($admin == 'plugin_main') {
$o.="<h4>WDir</h4>";
$o .= "-pth- ".$pth['file']['plugin_main'];
$o .= "<br>-admin- ".$admin;
$o .= "<br>-action- ".$action;
$o .= "<br>-subaction- ".$subaction."<br>";
}
*/
}
?>