Example #1
0
    $path = dirname(str_replace('//', '/', str_replace(str_replace('\\', '/', realpath($_SERVER['DOCUMENT_ROOT'])), '/', str_replace('\\', '/', dirname(realpath(__FILE__))))));
    $path = checkSlash($path, 'remove');
    return $path;
}
///////////////////////////////
// Set password to your own! //
///////////////////////////////
// Remove $pass to allow saving without password (should be only done in otherwise protected areas)
$pass = mt_rand() . rand();
// mt_rand().rand();
// General enabling of this file, can be overriden by $pass
$allowSave = false;
// Please set the Path to /pic/hotspotJS/ folder or any other where you want to save the hotspots
$pathToCropJSON = checkSlash(realpath($_SERVER['DOCUMENT_ROOT']) . '/' . installPath() . '/pic/cropJSON/', 'add');
// Path for backups of the old file
$pathToCropBackupJSON = checkSlash(realpath($_SERVER['DOCUMENT_ROOT']) . '/' . installPath() . '/pic/cropJSON/backup', 'add');
// Postfix for backup files
$backUpPostFix = date('Y.m.d_H-i-s');
// Set default for making backup to false
$makeBackUp = false;
// Set backup action depending on $_POST parameter
if (isset($_POST['backup']) && $_POST['backup'] == '1') {
    $makeBackUp = true;
}
// File path
$file = checkSlash($pathToCropJSON . $_POST['fileName'] . '.json');
$fileBackUp = checkSlash($pathToCropBackupJSON . $_POST['fileName'] . '_' . $backUpPostFix . '.json');
// Messages for working with this file
if (!is_dir($pathToCropJSON)) {
    echo '> Variable $pathToCropJSON - path to cropJSON directory (' . $pathToCropJSON . ') is not set correctly. 
	Please open /axZm/saveCropJSON.php and set this variable manually.<br>';
    return $input;
}
// Get installation path
function installPath()
{
    $path = dirname(str_replace('//', '/', str_replace(str_replace('\\', '/', realpath($_SERVER['DOCUMENT_ROOT'])), '/', str_replace('\\', '/', dirname(realpath(__FILE__))))));
    $path = checkSlash($path, 'remove');
    return $path;
}
// Set password to your own
// Remove $pass to allow saving without password (should be only done in otherwise protected areas)
$pass = mt_rand() . rand();
// General enabling of this file, can be overriden by $pass
$allowSave = false;
// Please set the Path to /pic/hotspotJS/ folder any other where you want to save the hotspots
$pathToHotspotJS = checkSlash(realpath($_SERVER['DOCUMENT_ROOT']) . '/' . installPath() . '/pic/hotspotJS/', 'add');
// File path
$file = checkSlash($pathToHotspotJS . $_POST['fileName'] . '.js');
// Messages for working with this file
if (!is_dir($pathToHotspotJS)) {
    echo 'Variable $pathToHotspotJS - path to hotspotJS directory (' . $pathToHotspotJS . ') is not set correctly. \\
	Please open /axZm/saveHotspotJS.php and set this variable manually.';
    exit;
}
// Not writeable path
if (!is_writable($pathToHotspotJS)) {
    echo $pathToHotspotJS . ' is not writeable by PHP. Please change chmod (e.g. 775 or 777).';
    exit;
}
// Password check
if (isset($pass) && isset($_POST['password']) && $_POST['password'] == $pass) {