Changeset 521 for trunk/Common


Ignore:
Timestamp:
Apr 14, 2013, 9:04:17 PM (12 years ago)
Author:
chronos
Message:
  • Upraveno: Finance přepracovány na aplikační modul. Upraveny URL adresy stránek.
  • Přidáno: Slučování registrovaných stránek do stromu stránek. Registgrovat lze nyní také pomocí cesty jako pole adresářů URL.
Location:
trunk/Common
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Common/Global.php

    r518 r521  
    2222include_once(dirname(__FILE__).'/Page.php');
    2323include_once(dirname(__FILE__).'/Form/Form.php');
    24 include_once(dirname(__FILE__).'/../finance/bills.php');
    25 include_once(dirname(__FILE__).'/../finance/finance.php');
    2624include_once(dirname(__FILE__).'/../form_classes.php');
    2725
     
    7068  function RegisterPage($Path, $Handler)
    7169  {
    72     $this->Pages[$Path] = $Handler;
     70    if(is_array($Path))
     71    {
     72      $Page = &$this->Pages;
     73      $LastKey = array_pop($Path);
     74      foreach($Path as $PathItem)
     75      {
     76        $Page = &$Page[$PathItem];       
     77      }
     78      if(!is_array($Page)) $Page = array('' => $Page);
     79      $Page[$LastKey] = $Handler;
     80    } else $this->Pages[$Path] = $Handler;
    7381  }
    7482 
    7583  function SearchPage($PathItems, $Pages)
    7684  {
    77     $PathItem = $PathItems[0];
     85    if(count($PathItems) > 0) $PathItem = $PathItems[0];
     86      else $PathItem = '';
    7887    if(array_key_exists($PathItem, $Pages))
    7988    {
     
    8695  }
    8796 
     97  function PageNotFound()
     98  {
     99    return('Page '.implode('/', $this->PathItems).' not found.');
     100  }
     101 
    88102  function ShowPage()
    89103  {
     
    96110      $Page->Database = &$this->Database;
    97111      $Page->GetOutput();
    98     } else echo('Page '.implode('/', $this->PathItems).' not found.');
     112    } else echo($this->PageNotFound());
    99113  }
    100114 
  • trunk/Common/Page.php

    r519 r521  
    3333    while(strpos($ScriptName, '//') !== false)
    3434      $ScriptName = str_replace('//', '/', $ScriptName);
     35    if(strpos($ScriptName, '?') !== false)
     36      $ScriptName = substr($ScriptName, 0, strrpos($ScriptName, '?'));
    3537    $ScriptName = substr($ScriptName, strlen($this->System->Link('')));
    3638    if(substr($ScriptName, -1, 1) == '/') $ScriptName = substr($ScriptName, 0, -1);
  • trunk/Common/Version.php

    r519 r521  
    11<?php
    22
    3 $Revision = 519; // Subversion revision
    4 $DatabaseRevision = 517;
    5 $ReleaseTime = '2013-04-13';
     3$Revision = 521; // Subversion revision
     4$DatabaseRevision = 517; // SQL structure revision
     5$ReleaseTime = '2013-04-14';
    66
    77?>
Note: See TracChangeset for help on using the changeset viewer.