[ Index ]

PHP Cross Reference of Mambo 4.6.5

[ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/mambots/editors/mostlyce/jscripts/tiny_mce/ -> auth_check.php (source)

   1  <?php
   2  /**
   3  * @package Mambo
   4  * @author Mambo Foundation Inc see README.php
   5  * @copyright (C) 2000 - 2009 Mambo Foundation Inc.
   6  * See COPYRIGHT.php for copyright notices and details.
   7  * @license GNU/GPL Version 2, see LICENSE.php
   8  *
   9  * Redistributions of files must retain the above copyright notice.
  10  *
  11  * Mambo is free software; you can redistribute it and/or
  12  * modify it under the terms of the GNU General Public License
  13  * as published by the Free Software Foundation; version 2 of the License.
  14  */
  15  
  16  function externalCallCheck($path,  $secret) {
  17      if (isset($_COOKIE['mostlyce']['startup_key']) && isset($_COOKIE['mostlyce']['usertype'])) {
  18          require_once ($path.'/includes/phpInputFilter/class.inputfilter.php');
  19          $iFilter = new InputFilter( null, null, 1, 1 );
  20          $startupKey = trim($iFilter->process($_COOKIE['mostlyce']['startup_key'])); //The MOStlyCE rebuild key should match this
  21          $usertype = strtolower(str_replace(' ', '', trim($iFilter->process($_COOKIE['mostlyce']['usertype']))));
  22      } else {
  23          return false;
  24      }    
  25  
  26      $env = md5($_SERVER['HTTP_USER_AGENT']);
  27      $rebuildKey=md5($secret.$env.$_SERVER['REMOTE_ADDR']);
  28      if ($rebuildKey!==$startupKey) {
  29          return false;
  30      }
  31  
  32      //Valid user types
  33      $vUsers=array('author', 'editor', 'publisher', 'manager', 'administrator', 'superadministrator');
  34      if (!in_array($usertype, $vUsers)) {
  35          return false;
  36      }
  37      
  38      return true;
  39  }
  40  
  41  ?>