'; } else { $config = ''; } $f = fopen(CLICKHEAT_CONFIG, 'w'); if (is_resource($f)) { fputs($f, $config, strlen($config)); fclose($f); header('Location: '.CLICKHEAT_INDEX_PATH.'action=view'); exit; } } } $check = isset($_POST['check']); $checks = true; $memoryLimit = @ini_get('memory_limit'); if (strpos($memoryLimit, 'M') !== false) { $memoryLimit = (int) $memoryLimit; } else { $memoryLimit = floor($memoryLimit / (1024 * 1024)); } /* Set default values if nothing is set in the config file */ if (IS_PIWIK_MODULE === true) { $basePath = explode('/', rtrim(CLICKHEAT_ROOT, '/')); array_pop($basePath); array_pop($basePath); array_pop($basePath); $basePath = implode('/', $basePath).'/datas'; if (!is_dir($basePath)) { @mkdir($basePath); } $basePath .= '/clickheat'; if (!is_dir($basePath)) { @mkdir($basePath); } } else { $basePath = preg_replace('~[\\\\/]+~', '/', dirname(__FILE__)); } $clickheatDefault = array( 'logPath' => $basePath.'/logs/', 'cachePath' => $basePath.'/cache/', 'referers' => false, 'groups' => false, 'filesize' => 0, 'adminLogin' => '', 'adminPass' => '', 'viewerLogin' => '', 'viewerPass' => '', 'memory' => $memoryLimit === 0 ? 8 : $memoryLimit, 'step' => 5, 'dot' => 19, 'flush' => 40, 'start' => 'm', 'palette' => false, 'heatmap' => true, 'hideIframes' => true, 'hideFlashes' => true, 'yesterday' => false, 'alpha' => 80); if (isset($clickheatConf)) { $clickheatConf = array_merge($clickheatDefault, $clickheatConf); } else { $clickheatConf = &$clickheatDefault; } /* Overwrite value with POST */ if (isset($_POST['logPath'])) { $clickheatConf['logPath'] = preg_replace('~[\\\\/]+~', '/', rtrim($_POST['logPath'], '/')).'/'; } if (isset($_POST['cachePath'])) { $clickheatConf['cachePath'] = preg_replace('~[\\\\/]+~', '/', rtrim($_POST['cachePath'], '/')).'/'; } if (isset($_POST['referers'])) { if (trim($_POST['referers']) === '') { $clickheatConf['referers'] = false; } else { $clickheatConf['referers'] = explode(',', trim(trim(str_replace(' ', '', $_POST['referers'])), ',')); } } if (isset($_POST['groups'])) { if (trim($_POST['groups']) === '') { $clickheatConf['groups'] = false; } else { $clickheatConf['groups'] = explode(',', trim(trim(str_replace(' ', '', $_POST['groups'])), ',')); } } if (isset($_POST['adminLogin'])) { $clickheatConf['adminLogin'] = $_POST['adminLogin']; } if (isset($_POST['_adminPass']) && isset($_POST['_adminPass2']) && $_POST['_adminPass'] !== '' && $_POST['_adminPass'] === $_POST['_adminPass2']) { $clickheatConf['adminPass'] = md5($_POST['_adminPass']); } elseif (isset($_POST['adminPass'])) { $clickheatConf['adminPass'] = $_POST['adminPass']; } if (isset($_POST['viewerLogin'])) { $clickheatConf['viewerLogin'] = $_POST['viewerLogin']; } if (isset($_POST['_viewerPass']) && isset($_POST['_viewerPass2']) && $_POST['_viewerPass'] !== '' && $_POST['_viewerPass'] === $_POST['_viewerPass2']) { $clickheatConf['viewerPass'] = md5($_POST['_viewerPass']); } elseif (isset($_POST['viewerPass'])) { $clickheatConf['viewerPass'] = $_POST['viewerPass']; } if (isset($_POST['filesize'])) { $clickheatConf['filesize'] = $_POST['filesize'] * 1024; } if (isset($_POST['memory'])) { $clickheatConf['memory'] = $_POST['memory']; } if (isset($_POST['step'])) { $clickheatConf['step'] = $_POST['step']; } if (isset($_POST['dot'])) { $clickheatConf['dot'] = $_POST['dot']; } if (isset($_POST['flush'])) { $clickheatConf['flush'] = $_POST['flush']; } if (isset($_POST['start'])) { $clickheatConf['start'] = $_POST['start']; } if (isset($_POST['palette'])) { $clickheatConf['palette'] = $_POST['palette'] === '1'; } if (isset($_POST['heatmap'])) { $clickheatConf['heatmap'] = $_POST['heatmap'] === '1'; } if (isset($_POST['hideIframes'])) { $clickheatConf['hideIframes'] = $_POST['hideIframes'] === '1'; } if (isset($_POST['hideFlashes'])) { $clickheatConf['hideFlashes'] = $_POST['hideFlashes'] === '1'; } if (isset($_POST['yesterday'])) { $clickheatConf['yesterday'] = $_POST['yesterday'] === '1'; } if (isset($_POST['alpha'])) { $clickheatConf['alpha'] = $_POST['alpha']; } /* Change type according to configuration needs */ $clickheatConf['filesize'] = (int) abs($clickheatConf['filesize']); $clickheatConf['memory'] = (int) abs($clickheatConf['memory']); $clickheatConf['step'] = (int) abs($clickheatConf['step']); $clickheatConf['dot'] = (int) abs($clickheatConf['dot']); $clickheatConf['flush'] = (int) abs($clickheatConf['flush']); $clickheatConf['start'] = in_array($clickheatConf['start'], array('m', 's')) ? $clickheatConf['start'] : 'm'; $clickheatConf['palette'] = (bool) $clickheatConf['palette']; $clickheatConf['heatmap'] = (bool) $clickheatConf['heatmap']; $clickheatConf['hideIframes'] = (bool) $clickheatConf['hideIframes']; $clickheatConf['hideFlashes'] = (bool) $clickheatConf['hideFlashes']; $clickheatConf['yesterday'] = (bool) $clickheatConf['yesterday']; $clickheatConf['alpha'] = min(100, (int) abs($clickheatConf['alpha'])); /* Special checks for available memory */ /* Can't set the memory limit */ if (@ini_set('memory_limit', '5M') === false) { /* PHP doesn't give us the real limit */ if ($memoryLimit === 0) { $memoryLimit = 8; $memoryRange = array(8, 8); } else { $memoryRange = array($memoryLimit, $memoryLimit); } } elseif (@ini_get('memory_limit') !== '5M') { /* Memory limit can be set but can't be changed */ $memoryRange = array($memoryLimit, $memoryLimit); } else { $memoryRange = array(1, 256); } ?>
ClickHeat



1.2 : «%%» in urls to be removed, and cache to be deleted */ if (count($_POST) === 0 && !isset($clickheatConf['version'])) { echo ''.LANG_UPGRADE.' 1.1 -> 1.2 OK (**'; include CLICKHEAT_ROOT.'scripts/upgrade-1.1.php'; echo '**)
'.LANG_UPGRADE_NEXT.'.
'; } } ?>
value="1" /> (: on) OK '; } ?>
value="1" /> (: off) OK '; } ?>
(: 80) OK '; } ?>
(: 40) OK '; } ?>
/> /> OK '; } ?>
value="1" /> (: on) OK '; } ?>
value="1" /> (: on) OK '; } ?>
KO', LANG_CONFIG_LOGPATH_DIR; } else { /** Check if creation of a file is allowed */ $f = fopen($clickheatConf['logPath'].'test.txt', 'w'); if (!is_resource($f)) { $checks = false; echo 'KO', LANG_CONFIG_LOGPATH_KO; } else { fclose($f); unlink($clickheatConf['logPath'].'test.txt'); echo 'OK '; } } } ?>
KO', LANG_CONFIG_CACHEPATH_DIR; } else { /** Check if creation of a file is allowed */ $f = fopen($clickheatConf['cachePath'].'test.txt', 'w'); if (!is_resource($f)) { $checks = false; echo 'KO', LANG_CONFIG_CACHEPATH_KO; } else { fclose($f); unlink($clickheatConf['cachePath'].'test.txt'); echo 'OK '; } } } ?>
$memoryRange[1]) { $checks = false; echo 'KO', LANG_CONFIG_MEMORY_KO; } else { echo 'OK '; } } ?>
(: 5) KO', LANG_CONFIG_STEP_KO; } else { echo 'OK '; } } ?>
(: 19) KO', LANG_CONFIG_DOT_KO; } else { echo 'OK '; } } ?>
value="1" /> (: off) OK '; } ?>
OK '; } ?>
OK '; } ?>
(: 0) OK '; } ?>
KO', LANG_CONFIG_LOGIN; } else { echo 'OK '; } } ?>

KO', LANG_CONFIG_MATCH; } elseif ($clickheatConf['adminPass'] === '') { $checks = false; echo 'KO', LANG_CONFIG_PASS; } else { echo 'OK '; } } ?>
KO', LANG_CONFIG_LOGIN; } else { echo 'OK '; } } ?>

KO', LANG_CONFIG_MATCH; } elseif ($clickheatConf['viewerPass'] === '' && $clickheatConf['viewerLogin'] !== '') { $checks = false; echo 'KO', LANG_CONFIG_PASS; } else { echo 'OK '; } } ?>
 




'.LANG_CHECK_NOT_WRITABLE.' ('.dirname(CLICKHEAT_CONFIG).'/\')'; } else { fputs($f, 'delete this file'); fclose($f); unlink(dirname(CLICKHEAT_CONFIG).'/temp.tmp'); echo ''; } } ?>