Subversion Repositories computer_asset_manager_v1

Rev

Rev 1 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php

   function is_cli() {
       if ( defined('STDIN') ) {
           return true;
       }

       if ( php_sapi_name() === 'cli' ) {
           return true;
       }

       if ( array_key_exists('SHELL', $_ENV) ) {
           return true;
       }

       if ( empty($_SERVER['REMOTE_ADDR']) and !isset($_SERVER['HTTP_USER_AGENT']) and count($_SERVER['argv']) > 0) {
           return true;
       } 

       if ( !array_key_exists('REQUEST_METHOD', $_SERVER) ) {
           return true;
       }

       return false;
   }

   if ( is_cli() ) {
      include_once( dirname(__FILE__) . '/../../camp_config.php' );
   } else {
      include_once( realpath( $_SERVER['DOCUMENT_ROOT'] . '/../camp_config.php' ) );
   }
?>