Changeset 69 for trunk/Global.php


Ignore:
Timestamp:
Feb 28, 2016, 10:54:30 AM (9 years ago)
Author:
chronos
Message:
  • Modified: Use object oriented approach for page drawing using Application class.
  • Added: SQL updated will be automatic using UpdateTrace.php file.
  • Added: Use generic setup page at URL /setup for SQL structure update.
  • Modified: Update Common package to newer version.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Global.php

    r67 r69  
    11<?php
    22
    3 include_once('Version.php');
    43include_once('Types.php');
    54include_once('Classes.php');
    65include_once('Packages/Common/Common.php');
    7 include_once('Measure.php');
    8 include_once('Application.php');
    9 include_once('Update.php');
    106
    117function HumanDate($Time)
     
    1814  list($Usec, $Sec) = explode(" ", microtime());
    1915  return ((float)$Usec + (float)$Sec);
    20 }
    21 
    22 function ShowPage($Content)
    23 {
    24   global $Config, $ReleaseTime, $Revision;
    25 
    26   $Output = '<?xml version="1.0" encoding="'.$Config['Web']['Charset'].'"?>'."\n".
    27   '<!DOCTYPE html>'.
    28   '<html>'.
    29   '<head>'.
    30   '<meta http-equiv="Content-Language" content="cs"/>'.
    31   '<meta http-equiv="content-type" content="text/html; charset='.$Config['Web']['Charset'].'" />'.
    32   '<meta name="robots" content="all" />'.
    33   '<title>'.$Config['Web']['Title'].'</title>'.
    34   '<link rel="StyleSheet" href="style/style.css" type="text/css" media="all"/>'.
    35   '</head><body>';
    36   $Output .= $Content;
    37   $Output .= '<br/><div style="text-align: center; font-size: small;">Verze: '.$Revision.' ('.HumanDate($ReleaseTime).')'.
    38     ' &nbsp; <a href="http://svn.zdechov.net/trac/statistic/browser/trunk">Zdrojový kód</a> &nbsp; '.
    39     '<a href="http://svn.zdechov.net/trac/statistic/log/trunk?verbose=on">Historie změn</a></div>';
    40   $Output .= '</body></html>';
    41   echo($Output);
    4216}
    4317
     
    9771  return($Output);
    9872}
     73
     74function ProcessURL()
     75{
     76  if(array_key_exists('REDIRECT_QUERY_STRING', $_SERVER))
     77    $PathString = $_SERVER['REDIRECT_QUERY_STRING'];
     78    else $PathString = '';
     79  if(substr($PathString, -1, 1) == '/') $PathString = substr($PathString, 0, -1);
     80  $PathItems = explode('/', $PathString);
     81  if(array_key_exists('REQUEST_URI', $_SERVER) and (strpos($_SERVER['REQUEST_URI'], '?') !== false))
     82    $_SERVER['QUERY_STRING'] = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], '?') + 1);
     83    else $_SERVER['QUERY_STRING'] = '';
     84  parse_str($_SERVER['QUERY_STRING'], $_GET);
     85  return($PathItems);
     86}
     87
     88function GetQueryStringArray($QueryString)
     89{
     90  $Result = array();
     91  $Parts = explode('&', $QueryString);
     92  foreach($Parts as $Part)
     93  {
     94    if($Part != '')
     95    {
     96      if(!strpos($Part, '=')) $Part .= '=';
     97      $Item = explode('=', $Part);
     98      $Result[$Item[0]] = $Item[1];
     99    }
     100  }
     101  return($Result);
     102}
     103
     104function SetQueryStringArray($QueryStringArray)
     105{
     106  $Parts = array();
     107  foreach($QueryStringArray as $Index => $Item)
     108  {
     109    $Parts[] = $Index.'='.$Item;
     110  }
     111  return(implode('&amp;', $Parts));
     112}
Note: See TracChangeset for help on using the changeset viewer.