Skip to content

Avoid empty files if the encoding isnt ascii #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions clsAWStats.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class clsAWStats
var $iDailyUniqueAvg = 0;
var $sFileName = "";

function clsAWStats($sStatName, $sFilePath = "", $sFileName = "", $iYear = 0, $iMonth = 0)
function __construct($sStatName, $sFilePath = "", $sFileName = "", $iYear = 0, $iMonth = 0)
{
// validate dates
$dtDate = ValidateDate($iYear, $iMonth);
Expand All @@ -70,7 +70,7 @@ function clsAWStats($sStatName, $sFilePath = "", $sFileName = "", $iYear = 0, $i
$this->sFileName = $sFileName;

if (is_readable($sFilePath)) {
$this->sAWStats = htmlspecialchars(file_get_contents($sFilePath));
$this->sAWStats = htmlspecialchars(file_get_contents($sFilePath), ENT_SUBSTITUTE);
$this->bLoaded = true;
}
else
Expand Down Expand Up @@ -242,7 +242,7 @@ function CreatePagesXMLString($urlAliasFile = null)
$aXML[] = "</data_exit>\n";

// return
return implode($aXML, "");
return implode("", $aXML);
}

function CreateXMLString($sSection)
Expand Down Expand Up @@ -270,7 +270,7 @@ function GetSection($sSection)
return array();
$iEndPos = strpos($this->sAWStats, ("\nEND_" . $sSection), $iStartPos);
$max = 0;
$aDesc = $GLOBALS["aDesc"];
$aDesc = array();#$GLOBALS["aDesc"];
if (isset($_GET["max"]))
$max = $_GET["max"];
$arrStat = explode("\n", substr($this->sAWStats, ($iStartPos + 1), ($iEndPos - $iStartPos - 1)));
Expand Down Expand Up @@ -424,6 +424,7 @@ function GetLogList($sStatsName, $sFilePath, $sFileName = "", $sParts = "")
$aTemp[] = mktime(0, 0, 0, intval($sMonth), 1, intval($sYear));
}
}
closedir($oDir);
if (count($aTemp) < 1) {
Error("NoLogsFound", $GLOBALS["g_sConfig"]);
}
Expand Down
14 changes: 7 additions & 7 deletions clsPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class clsPage
var $sSubMenuJS = "";
var $aViews = array();

function clsPage($type = "")
function __construct($type = "")
{
if (strlen($type) == 0) {
$type = "web";
Expand Down Expand Up @@ -117,7 +117,7 @@ function DrawHeader($dtDate)
function DrawFooter()
{
$aString = explode("_", str_replace("]", "]_", str_replace("[", "_[", Lang("Powered by [AWSTART]AWStats[END]. Made beautiful by [JAWSTART]JAWStats Web Statistics and Analytics[END]."))));
for ($i = 0; $i < count($aString); $i++) {
for ($i = 0; $i < count($aString) - 1; $i++) {
if ((strlen(trim($aString[$i])) > 0) && (substr($aString[$i], 0, 1) != "[") && (substr($aString[$i + 1], 0, 5) != "[END]")) {
$aString[$i] = ("<span>" . $aString[$i] . "</span>");
} else {
Expand Down Expand Up @@ -187,7 +187,7 @@ function LanguageSort($a, $b)
$aHTML[] = "</ul>\n</td>\n</tr>\n</table>";
$aHTML[] = "</div></div>";

return implode($aHTML, "\n");
return implode("\n", $aHTML);
}

function ToolChangeMonth()
Expand Down Expand Up @@ -230,7 +230,7 @@ function ToolChangeMonth()
$aHTML[] = "</table>";
$aHTML[] = "</div></div>";

return implode($aHTML, "\n");
return implode("\n", $aHTML);
}

function ToolChangeSite()
Expand Down Expand Up @@ -270,7 +270,7 @@ function ToolChangeSite()
$aHTML[] = "</ul>\n</td>\n</tr>\n</table>";
$aHTML[] = "</div></div>";

return implode($aHTML, "\n");
return implode("\n", $aHTML);
}

function ToolUpdateSite()
Expand All @@ -286,7 +286,7 @@ function ToolUpdateSite()
$aHTML[] = "<input type=\"password\" id=\"password\" onkeyup=\"UpdateSiteKeyUp(event)\" />";
$aHTML[] = "<input type=\"button\" onclick=\"UpdateSite()\" value=\"" . Lang("Update") . "\" />";
$aHTML[] = "</div>\n</div>\n</div>";
return implode($aHTML, "\n");
return implode("\n", $aHTML);
}

function ToolChangeParts($sParts, $arrMissingParts)
Expand All @@ -306,5 +306,5 @@ function ToolChangeParts($sParts, $arrMissingParts)
}
$aHTML[] = "</td>\n</tr>\n</table>";
$aHTML[] = "</div>\n</div>";
return implode($aHTML, "\n");
return implode("\n", $aHTML);
}