[ Index ] |
|
Code source de osCommerce 2.2ms2-060817 |
1 <?php 2 /* 3 $Id: navigation_history.php,v 1.6 2003/06/09 22:23:43 hpdl Exp $ 4 5 osCommerce, Open Source E-Commerce Solutions 6 http://www.oscommerce.com 7 8 Copyright (c) 2003 osCommerce 9 10 Released under the GNU General Public License 11 */ 12 13 class navigationHistory { 14 var $path, $snapshot; 15 16 function navigationHistory() { 17 $this->reset(); 18 } 19 20 function reset() { 21 $this->path = array(); 22 $this->snapshot = array(); 23 } 24 25 function add_current_page() { 26 global $PHP_SELF, $HTTP_GET_VARS, $HTTP_POST_VARS, $request_type, $cPath; 27 28 $set = 'true'; 29 for ($i=0, $n=sizeof($this->path); $i<$n; $i++) { 30 if ( ($this->path[$i]['page'] == basename($PHP_SELF)) ) { 31 if (isset($cPath)) { 32 if (!isset($this->path[$i]['get']['cPath'])) { 33 continue; 34 } else { 35 if ($this->path[$i]['get']['cPath'] == $cPath) { 36 array_splice($this->path, ($i+1)); 37 $set = 'false'; 38 break; 39 } else { 40 $old_cPath = explode('_', $this->path[$i]['get']['cPath']); 41 $new_cPath = explode('_', $cPath); 42 43 for ($j=0, $n2=sizeof($old_cPath); $j<$n2; $j++) { 44 if ($old_cPath[$j] != $new_cPath[$j]) { 45 array_splice($this->path, ($i)); 46 $set = 'true'; 47 break 2; 48 } 49 } 50 } 51 } 52 } else { 53 array_splice($this->path, ($i)); 54 $set = 'true'; 55 break; 56 } 57 } 58 } 59 60 if ($set == 'true') { 61 $this->path[] = array('page' => basename($PHP_SELF), 62 'mode' => $request_type, 63 'get' => $HTTP_GET_VARS, 64 'post' => $HTTP_POST_VARS); 65 } 66 } 67 68 function remove_current_page() { 69 global $PHP_SELF; 70 71 $last_entry_position = sizeof($this->path) - 1; 72 if ($this->path[$last_entry_position]['page'] == basename($PHP_SELF)) { 73 unset($this->path[$last_entry_position]); 74 } 75 } 76 77 function set_snapshot($page = '') { 78 global $PHP_SELF, $HTTP_GET_VARS, $HTTP_POST_VARS, $request_type; 79 80 if (is_array($page)) { 81 $this->snapshot = array('page' => $page['page'], 82 'mode' => $page['mode'], 83 'get' => $page['get'], 84 'post' => $page['post']); 85 } else { 86 $this->snapshot = array('page' => basename($PHP_SELF), 87 'mode' => $request_type, 88 'get' => $HTTP_GET_VARS, 89 'post' => $HTTP_POST_VARS); 90 } 91 } 92 93 function clear_snapshot() { 94 $this->snapshot = array(); 95 } 96 97 function set_path_as_snapshot($history = 0) { 98 $pos = (sizeof($this->path)-1-$history); 99 $this->snapshot = array('page' => $this->path[$pos]['page'], 100 'mode' => $this->path[$pos]['mode'], 101 'get' => $this->path[$pos]['get'], 102 'post' => $this->path[$pos]['post']); 103 } 104 105 function debug() { 106 for ($i=0, $n=sizeof($this->path); $i<$n; $i++) { 107 echo $this->path[$i]['page'] . '?'; 108 while (list($key, $value) = each($this->path[$i]['get'])) { 109 echo $key . '=' . $value . '&'; 110 } 111 if (sizeof($this->path[$i]['post']) > 0) { 112 echo '<br>'; 113 while (list($key, $value) = each($this->path[$i]['post'])) { 114 echo ' <b>' . $key . '=' . $value . '</b><br>'; 115 } 116 } 117 echo '<br>'; 118 } 119 120 if (sizeof($this->snapshot) > 0) { 121 echo '<br><br>'; 122 123 echo $this->snapshot['mode'] . ' ' . $this->snapshot['page'] . '?' . tep_array_to_string($this->snapshot['get'], array(tep_session_name())) . '<br>'; 124 } 125 } 126 127 function unserialize($broken) { 128 for(reset($broken);$kv=each($broken);) { 129 $key=$kv['key']; 130 if (gettype($this->$key)!="user function") 131 $this->$key=$kv['value']; 132 } 133 } 134 } 135 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 19:48:25 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |