[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
Zen Cart 源代码 navigation_history.php

Zen Cart 源代码 navigation_history.php




下载文件

文件名: navigation_history.php
文件类型: PHP文件
文件大小: 4.8 KiB
MD5: c97cd590244356f030786f0cea9f0d07

navigation_history.php - 关闭高亮
  1. <?php
  2. /**
  3.  * Navigation_history Class.
  4.  *
  5.  * @package classes
  6.  * @copyright Copyright 2003-2006 Zen Cart Development Team
  7.  * @copyright Portions Copyright 2003 osCommerce
  8.  * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
  9.  * @version $Id: navigation_history.php 4383 2006-09-04 00:42:07Z drbyte $
  10.  */
  11. if (!defined('IS_ADMIN_FLAG')) {
  12.   die('Illegal Access');
  13. }
  14. /**
  15.  * Navigation_history Class.
  16.  * This class is used to manage navigation snapshots
  17.  *
  18.  * @package classes
  19.  */
  20. class navigationHistory extends base {
  21.   var $path, $snapshot;
  22.  
  23.   function navigationHistory() {
  24.     $this->reset();
  25.   }
  26.  
  27.   function reset() {
  28.     $this->path = array();
  29.     $this->snapshot = array();
  30.   }
  31.  
  32.   function add_current_page() {
  33.     global $request_type, $cPath;
  34.     $get_vars = "";
  35.  
  36.     if (is_array($_GET)) {
  37.       reset($_GET);
  38.       while (list($key, $value) = each($_GET)) {
  39.         if ($key != 'main_page') {
  40.           $get_vars[$key] = $value;
  41.         }
  42.       }
  43.     }
  44.  
  45.     $set = 'true';
  46.     for ($i=0, $n=sizeof($this->path); $i<$n; $i++) {
  47.       if ( ($this->path[$i]['page'] == $_GET['main_page']) ) {
  48.         if (isset($cPath)) {
  49.           if (!isset($this->path[$i]['get']['cPath'])) {
  50.             continue;
  51.           } else {
  52.             if ($this->path[$i]['get']['cPath'] == $cPath) {
  53.               array_splice($this->path, ($i+1));
  54.               $set = 'false';
  55.               break;
  56.             } else {
  57.               $old_cPath = explode('_', $this->path[$i]['get']['cPath']);
  58.               $new_cPath = explode('_', $cPath);
  59.  
  60.               for ($j=0, $n2=sizeof($old_cPath); $j<$n2; $j++) {
  61.                 if ($old_cPath[$j] != $new_cPath[$j]) {
  62.                   array_splice($this->path, ($i));
  63.                   $set = 'true';
  64.                   break 2;
  65.                 }
  66.               }
  67.             }
  68.           }
  69.         } else {
  70.           array_splice($this->path, ($i));
  71.           $set = 'true';
  72.           break;
  73.         }
  74.       }
  75.     }
  76.  
  77.     if ($set == 'true') {
  78.       if ($_GET['main_page']) {
  79.         $page = $_GET['main_page'];
  80.       } else {
  81.         $page = 'index';
  82.       }
  83.       $this->path[] = array('page' => $page,
  84.                             'mode' => $request_type,
  85.                             'get' => $get_vars,
  86.                             'post' => array() /*$_POST*/);
  87.     }
  88.   }
  89.  
  90.   function remove_current_page() {
  91.  
  92.     $last_entry_position = sizeof($this->path) - 1;
  93.     if ($this->path[$last_entry_position]['page'] == $_GET['main_page']) {
  94.       unset($this->path[$last_entry_position]);
  95.     }
  96.   }
  97.  
  98.   function set_snapshot($page = '') {
  99.     global $request_type;
  100.     $get_vars = array();
  101.     if (is_array($page)) {
  102.       $this->snapshot = array('page' => $page['page'],
  103.                               'mode' => $page['mode'],
  104.                               'get' => $page['get'],
  105.                               'post' => $page['post']);
  106.     } else {
  107.       reset($_GET);
  108.       while (list($key, $value) = each($_GET)) {
  109.         if ($key != 'main_page') {
  110.           $get_vars[$key] = $value;
  111.         }
  112.       }
  113.       if ($_GET['main_page']) {
  114.         $page = $_GET['main_page'];
  115.       } else {
  116.         $page = 'index';
  117.       }
  118.       $this->snapshot = array('page' => $page,
  119.                               'mode' => $request_type,
  120.                               'get' => $get_vars,
  121.                               'post' => array()/*$_POST*/);
  122.     }
  123.   }
  124.  
  125.   function clear_snapshot() {
  126.     $this->snapshot = array();
  127.   }
  128.  
  129.   function set_path_as_snapshot($history = 0) {
  130.     $pos = (sizeof($this->path)-1-$history);
  131.     $this->snapshot = array('page' => $this->path[$pos]['page'],
  132.                             'mode' => $this->path[$pos]['mode'],
  133.                             'get' => $this->path[$pos]['get'],
  134.                             'post' => $this->path[$pos]['post']);
  135.   }
  136.  
  137.   function debug() {
  138.     for ($i=0, $n=sizeof($this->path); $i<$n; $i++) {
  139.       echo $this->path[$i]['page'] . '?';
  140.       while (list($key, $value) = each($this->path[$i]['get'])) {
  141.         echo $key . '=' . $value . '&';
  142.       }
  143.       if (sizeof($this->path[$i]['post']) > 0) {
  144.         echo '<br />';
  145.         while (list($key, $value) = each($this->path[$i]['post'])) {
  146.           echo '&nbsp;&nbsp;<strong>' . $key . '=' . $value . '</strong><br />';
  147.         }
  148.       }
  149.       echo '<br />';
  150.     }
  151.  
  152.     if (sizeof($this->snapshot) > 0) {
  153.       echo '<br /><br />';
  154.  
  155.       echo $this->snapshot['mode'] . ' ' . $this->snapshot['page'] . '?' . zen_array_to_string($this->snapshot['get'], array(zen_session_name())) . '<br />';
  156.     }
  157.   }
  158.  
  159.   function unserialize($broken) {
  160.     for(reset($broken);$kv=each($broken);) {
  161.       $key=$kv['key'];
  162.       if (gettype($this->$key)!="user function")
  163.       $this->$key=$kv['value'];
  164.     }
  165.   }
  166. }
  167. ?>