[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.92 KiB
MD5: e9103035cadd35c0a9b48b195135475b

navigation_history.php - 关闭高亮
  1. <?php
  2. /**
  3.  * Navigation_history Class.
  4.  *
  5.  * @package classes
  6.  * @copyright Copyright 2003-2011 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 19328 2011-08-06 22:53:47Z 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.               $exit_loop = false;
  61.               for ($j=0, $n2=sizeof($old_cPath); $j<$n2; $j++) {
  62.                 if ($old_cPath[$j] != $new_cPath[$j]) {
  63.                   array_splice($this->path, ($i));
  64.                   $set = 'true';
  65.                   $exit_loop = true;
  66.                   break;
  67.                 }
  68.               }
  69.               if ($exit_loop == true) break;
  70.             }
  71.           }
  72.         } else {
  73.           array_splice($this->path, ($i));
  74.           $set = 'true';
  75.           break;
  76.         }
  77.       }
  78.     }
  79.  
  80.     if ($set == 'true') {
  81.       if ($_GET['main_page']) {
  82.         $page = $_GET['main_page'];
  83.       } else {
  84.         $page = 'index';
  85.       }
  86.       $this->path[] = array('page' => $page,
  87.                             'mode' => $request_type,
  88.                             'get' => $get_vars,
  89.                             'post' => array() /*$_POST*/);
  90.     }
  91.   }
  92.  
  93.   function remove_current_page() {
  94.  
  95.     $last_entry_position = sizeof($this->path) - 1;
  96.     if ($this->path[$last_entry_position]['page'] == $_GET['main_page']) {
  97.       unset($this->path[$last_entry_position]);
  98.     }
  99.   }
  100.  
  101.   function set_snapshot($page = '') {
  102.     global $request_type;
  103.     $get_vars = array();
  104.     if (is_array($page)) {
  105.       $this->snapshot = array('page' => $page['page'],
  106.                               'mode' => $page['mode'],
  107.                               'get' => $page['get'],
  108.                               'post' => $page['post']);
  109.     } else {
  110.       reset($_GET);
  111.       while (list($key, $value) = each($_GET)) {
  112.         if ($key != 'main_page') {
  113.           $get_vars[$key] = $value;
  114.         }
  115.       }
  116.       if ($_GET['main_page']) {
  117.         $page = $_GET['main_page'];
  118.       } else {
  119.         $page = 'index';
  120.       }
  121.       $this->snapshot = array('page' => $page,
  122.                               'mode' => $request_type,
  123.                               'get' => $get_vars,
  124.                               'post' => array()/*$_POST*/);
  125.     }
  126.   }
  127.  
  128.   function clear_snapshot() {
  129.     $this->snapshot = array();
  130.   }
  131.  
  132.   function set_path_as_snapshot($history = 0) {
  133.     $pos = (sizeof($this->path)-1-$history);
  134.     $this->snapshot = array('page' => $this->path[$pos]['page'],
  135.                             'mode' => $this->path[$pos]['mode'],
  136.                             'get' => $this->path[$pos]['get'],
  137.                             'post' => $this->path[$pos]['post']);
  138.   }
  139.  
  140.   function debug() {
  141.     for ($i=0, $n=sizeof($this->path); $i<$n; $i++) {
  142.       echo $this->path[$i]['page'] . '?';
  143.       while (list($key, $value) = each($this->path[$i]['get'])) {
  144.         echo $key . '=' . $value . '&';
  145.       }
  146.       if (sizeof($this->path[$i]['post']) > 0) {
  147.         echo '<br />';
  148.         while (list($key, $value) = each($this->path[$i]['post'])) {
  149.           echo '&nbsp;&nbsp;<strong>' . $key . '=' . $value . '</strong><br />';
  150.         }
  151.       }
  152.       echo '<br />';
  153.     }
  154.  
  155.     if (sizeof($this->snapshot) > 0) {
  156.       echo '<br /><br />';
  157.  
  158.       echo $this->snapshot['mode'] . ' ' . $this->snapshot['page'] . '?' . zen_array_to_string($this->snapshot['get'], array(zen_session_name())) . '<br />';
  159.     }
  160.   }
  161.  
  162.   function unserialize($broken) {
  163.     for(reset($broken);$kv=each($broken);) {
  164.       $key=$kv['key'];
  165.       if (gettype($this->$key)!="user function")
  166.       $this->$key=$kv['value'];
  167.     }
  168.   }
  169. }
  170.