<?php
/**
* @package MOStlyCE
* @author Chad Auld (hide@address.com)
* @copyright Brilaps, LLC (http://brilaps.com)
* @license GNU Lesser General Public License (LGPL - http://www.gnu.org/licenses/lgpl.html)
*/
function externalCallCheck($path, $secret) {
if (isset($_COOKIE['mostlyce']['startup_key']) && isset($_COOKIE['mostlyce']['usertype'])) {
require_once($path.'/includes/phpInputFilter/class.inputfilter.php');
$iFilter = new InputFilter( null, null, 1, 1 );
$startupKey = trim($iFilter->process($_COOKIE['mostlyce']['startup_key'])); //The MOStlyCE rebuild key should match this
$usertype = strtolower(str_replace(' ', '', trim($iFilter->process($_COOKIE['mostlyce']['usertype']))));
} else {
return false;
}
$env = md5($_SERVER['HTTP_USER_AGENT']);
$rebuildKey=md5($secret.$env.$_SERVER['REMOTE_ADDR']);
if ($rebuildKey!==$startupKey) {
return false;
}
//Valid user types
$vUsers=array('author', 'editor', 'publisher', 'manager', 'administrator', 'superadministrator');
if (!in_array($usertype, $vUsers)) {
return false;
}
return true;
}
?>