Forum for users of JoomlaWatch / ExtraWatch for Joomla, Wordpress, Drupal, Magento, Prestashop

JoomlaWatch / ExtraWatch has following features: live real-time visitor statistics, location of your visitors on a map, blocking of users based on bad word list, front-end counters, click heat map, definition of goals and rules, graphs, directory size monitoring, monitoring of increase of database data in time, nightly email reports, interactive HTML5 chart of traffic flow within your website, SEO report with keyword statistics and keyword position trends

Welcome, Guest
Please Login or Register.    Lost Password?

Blank Screen when running Joomla Watch from Admin
(1 viewing) (1) Guest
Go to bottomPage: 1
TOPIC: Blank Screen when running Joomla Watch from Admin
#591
Blank Screen when running Joomla Watch from Admin 8 Years, 6 Months ago Karma: 0
I went to admin.joomlawatch.php and added a few DEBUG statements after line #27:

$dirname = dirname(__FILE__);
print "<p>DEBUG: dirname = $dirname</p>";

$dirnameExploded = explode(DIRECTORY_SEPARATOR, $dirname);
print "<p>DEBUG: dirnameExploded: " . sizeof($dirnameExploded) . "</p>";
print "<p>DEBUG: dirnameExploded[0] = \"$dirnameExploded[0]\"</p>";
print "<p>DEBUG: dirnameExploded[9] = \"$dirnameExploded[9]\"</p>";
print "<p>DEBUG: dirnameExploded[10] = \"$dirnameExploded[10]\"</p>";

$jBasePath = "";

$omitLast = 3;

print "<p>DEBUG: for (\$i = 0; \$i < sizeof(\$dirnameExploded) - \$omitLast; \$i++) {</p>";
for ($i = 0; $i < sizeof($dirnameExploded) - $omitLast; $i++) {

print "<p>DEBUG: (Pre-entry) $i: jBasePath = $jBasePath</p>";
print "<p>DEBUG: \$jBasePath .= \$dirnameExploded[$i];</p>";
print "<p>DEBUG: \$jBasePath .= $dirnameExploded[$i];</p>";
$jBasePath .= $dirnameExploded[$i];

if ($i <= $omitLast +1) {

print "<p>DEBUG: Entering if (\$i <= $omitLast +1) statement</p>";
$jBasePath .= DIRECTORY_SEPARATOR;
}
print "<p>DEBUG: $i: jBasePath = $jBasePath</p>";

}

define('JPATH_BASE2', $jBasePath);
print "<p>DEBUG: JPATH_BASE2 = $jBasePath</p>";

=====================

Here's the output:

DEBUG: dirname = /home/content/e/t/z/etzahaim/html/administrator/components/com_joomlawatch

DEBUG: dirnameExploded: 11

DEBUG: dirnameExploded[0] = ""

DEBUG: dirnameExploded[9] = "components"

DEBUG: dirnameExploded[10] = "com_joomlawatch"

DEBUG: for ($i = 0; $i < sizeof($dirnameExploded) - $omitLast; $i++) {

DEBUG: (Pre-entry) 0: jBasePath =

DEBUG: $jBasePath .= $dirnameExploded[0];

DEBUG: $jBasePath .= ;

DEBUG: Entering if ($i <= 3 +1) statement

DEBUG: 0: jBasePath = /

DEBUG: (Pre-entry) 1: jBasePath = /

DEBUG: $jBasePath .= $dirnameExploded[1];

DEBUG: $jBasePath .= home;

DEBUG: Entering if ($i <= 3 +1) statement

DEBUG: 1: jBasePath = /home/

DEBUG: (Pre-entry) 2: jBasePath = /home/

DEBUG: $jBasePath .= $dirnameExploded[2];

DEBUG: $jBasePath .= content;

DEBUG: Entering if ($i <= 3 +1) statement

DEBUG: 2: jBasePath = /home/content/

DEBUG: (Pre-entry) 3: jBasePath = /home/content/

DEBUG: $jBasePath .= $dirnameExploded[3];

DEBUG: $jBasePath .= e;

DEBUG: Entering if ($i <= 3 +1) statement

DEBUG: 3: jBasePath = /home/content/e/

DEBUG: (Pre-entry) 4: jBasePath = /home/content/e/

DEBUG: $jBasePath .= $dirnameExploded[4];

DEBUG: $jBasePath .= t;

DEBUG: Entering if ($i <= 3 +1) statement

DEBUG: 4: jBasePath = /home/content/e/t/

DEBUG: (Pre-entry) 5: jBasePath = /home/content/e/t/

DEBUG: $jBasePath .= $dirnameExploded[5];

DEBUG: $jBasePath .= z;

DEBUG: 5: jBasePath = /home/content/e/t/z

DEBUG: (Pre-entry) 6: jBasePath = /home/content/e/t/z

DEBUG: $jBasePath .= $dirnameExploded[6];

DEBUG: $jBasePath .= etzahaim;

DEBUG: 6: jBasePath = /home/content/e/t/zetzahaim

DEBUG: (Pre-entry) 7: jBasePath = /home/content/e/t/zetzahaim

DEBUG: $jBasePath .= $dirnameExploded[7];

DEBUG: $jBasePath .= html;

DEBUG: 7: jBasePath = /home/content/e/t/zetzahaimhtml

DEBUG: JPATH_BASE2 = /home/content/e/t/zetzahaimhtml

As you can see from the output, JPATH_BASE2 = "/home/content/e/t/zetzahaimhtml" and not "/home/content/e/t/z/etzahaim/html".

The error appears to be in the "if" statement:

if ($i <= $omitLast +1) {

This compares the exploded portion to a constant "4". In the output, you can see that after the fourth iteration of the loop, that the directory separator is no longer appended. (Loop #5 through #7). I believe what you wanted to say was:

if ($1 < (sizeof($directoryExploded) - ($omitLast + 1)) {

This will take the size of the $directoryExploded into account. Thus, the loop will not put the directory separator after the second to the last iteration of the loop. (Note that the operator was changed from "<=" to "<").
qazwart (User)
Fresh Boarder
Posts: 6
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#606
Re:Blank Screen when running Joomla Watch from Adm 8 Years, 6 Months ago Karma: 31
Hi, please try 1.2.5
matto (Admin)
Moderator
Posts: 770
graph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
Go to topPage: 1

Latest News

Get the latest freelance project announcements
Follow CodeGravity.com

Download ExtraWatch™

ExtraWatch™ FREE is Joomla, Wordpress, Prestashop, Magento plugin with following features: Live Stats, Nightly Email Reports, Goals, Graphs, Anti-spam, History and more