Exemple #1
0
<?php

$isNewAcc = empty(MonitisConf::$apiKey);
if (monitisPostInt('monitisFormSubmitted')) {
    $apiKey = trim(monitisPost('apiKey'));
    $secretKey = trim(monitisPost('secretKey'));
    $timezone = monitisPostInt('monitisTimeZone');
    if (empty($apiKey)) {
        MonitisApp::addError('Please provide valid API Key');
    } elseif (empty($secretKey)) {
        MonitisApp::addError('Please provide valid Secret Key');
    } elseif (!MonitisApi::checkKeysValid($apiKey, $secretKey)) {
        MonitisApp::addError('Wrong API and/or Secret keys provided.');
    } else {
        MonitisConf::update_config(array('apiKey' => $apiKey, 'secretKey' => $secretKey, 'timezone' => $timezone));
        if ($isNewAcc) {
            //header('location: ' . MONITIS_APP_URL . '&monitis_page=configure&isNewAcc=1');
            header('location: ' . MONITIS_APP_URL . '&monitis_page=tabadmin&sub=settings&isNewAcc=1');
        }
    }
} else {
    if ($isNewAcc) {
        MonitisApp::addMessage('Please enter your Monitis account information below.');
    }
}
MonitisApp::printNotifications();
?>
<script type="text/javascript">
$(document).ready(function() {
	var d = new Date();
	var minutes = d.getTimezoneOffset(); // minutes