"Fossies" - the Fresh Open Source Software Archive

Member "Open-Web-Analytics-1.7.0/log.php" (16 Sep 2020, 3107 Bytes) of package /linux/www/Open-Web-Analytics-1.7.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "log.php" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 1.6.9_vs_1.7.0.

    1 <?php
    2 
    3 //
    4 // Open Web Analytics - An Open Source Web Analytics Framework
    5 //
    6 // Copyright 2006 Peter Adams. All rights reserved.
    7 //
    8 // Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html
    9 //
   10 // Unless required by applicable law or agreed to in writing, software
   11 // distributed under the License is distributed on an "AS IS" BASIS,
   12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   13 // See the License for the specific language governing permissions and
   14 // limitations under the License.
   15 //
   16 // $Id$
   17 //
   18 
   19 include_once('owa_env.php');
   20 require_once(OWA_BASE_DIR.'/owa_lib.php');
   21 
   22 
   23 /**
   24  * Special HTTP Requests Controler
   25  * 
   26  * @author      Peter Adams <peter@openwebanalytics.com>
   27  * @copyright   Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>
   28  * @license     http://www.gnu.org/copyleft/gpl.html GPL v2.0
   29  * @category    owa
   30  * @package     owa
   31  * @version        $Revision$
   32  * @since        owa 1.0.0
   33  */
   34 
   35  // keep php executing even if the client closes the connection
   36 ignore_user_abort(true);
   37 
   38 // turn off gzip compression
   39 if ( function_exists( 'apache_setenv' ) ) {
   40     apache_setenv( 'no-gzip', 1 );
   41 }
   42 
   43 ini_set('zlib.output_compression', 0);
   44 
   45 // turn on output buffering if necessary
   46 if (ob_get_level() == 0) {
   47        ob_start();
   48 }
   49 
   50 // removing any content encoding like gzip etc.
   51 header('Content-encoding: none', true);
   52 
   53 //check to se if request is a POST
   54 if ($_SERVER['REQUEST_METHOD'] === 'POST') {
   55 
   56     // redirect to blank.php
   57     owa_lib::redirectBrowser( str_replace('log.php', 'blank.php', owa_lib::get_current_url() ) );
   58     // necessary or else buffer is not actually flushed
   59     echo ' ';
   60 } else {
   61     // return 1x1 pixel gif
   62     header("Content-type: image/gif");
   63     // needed to avoid cache time on browser side
   64     header("Content-Length: 42");
   65     header("Cache-Control: private, no-cache, no-cache=Set-Cookie, proxy-revalidate");
   66     header("Expires: Wed, 11 Jan 2000 12:59:00 GMT");
   67     header("Last-Modified: Wed, 11 Jan 2006 12:59:00 GMT");
   68     header("Pragma: no-cache");
   69 
   70     echo sprintf(
   71         '%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%',
   72         71,73,70,56,57,97,1,0,1,0,128,255,0,192,192,192,0,0,0,33,249,4,1,0,0,0,0,44,0,0,0,0,1,0,1,0,0,2,2,68,1,0,59
   73     );
   74 }
   75 
   76 // flush all output buffers. No reason to make the user wait for OWA.
   77 ob_flush();
   78 flush();
   79 ob_end_flush();
   80 
   81 // Create instance of OWA
   82 require_once(OWA_BASE_DIR.'/owa.php');
   83 $config = array(
   84 
   85     'tracking_mode' => true
   86 );
   87 
   88 $owa = new owa( $config );
   89 
   90 // check to see if this endpoint is enabled.
   91 if ( $owa->isEndpointEnabled( basename( __FILE__ ) ) ) {
   92 
   93     $owa->e->debug('Logging new tracking event...');
   94     
   95     $service = owa_coreAPI::serviceSingleton();
   96     $service->request->decodeRequestParams();
   97     $event = owa_coreAPI::supportClassFactory('base', 'event');
   98     $event->setEventType(owa_coreAPI::getRequestParam('event_type'));
   99     $event->setProperties($service->request->getAllOwaParams());
  100 
  101     owa_coreAPI::logEvent($event->getEventType(), $event);
  102 
  103 } else {
  104     // unload owa
  105     $owa->restInPeace();
  106 }
  107 
  108 ?>