Quick Search:

View

Revision:

Diff

Diff from 228 to:

Annotations

Annotate by Age | Author | Mixed | None
/fisheye/browse/osCommerce/branches/frank/tinymce/includes/classes/recently_visited.php

Annotated File View

hpdl
228
1 <?php
2 /*
3
4   osCommerce, Open Source E-Commerce Solutions
5   http://www.oscommerce.com
6
7   Copyright (c) 2004 osCommerce
8
9   Released under the GNU General Public License
10 */
11
12   class osC_Recently_visited {
13
14   var $visits = array();
15
16 /* Class constructor */
17
18    function osC_Recently_visited() {
19
20    }
21
22    function setProduct($id) {
23      foreach ($this->visits['products'] as $key => $value) {
24       if ($this->visits['products'][$key]['products_id'] == $id) {
25        unset($this->visits['products'][$key]);
26        break;
27       }
28      }
29
30      if (sizeof($this->visits['products']) >= MAX_RECENTLY_VISITED_PRODUCTS+3) {
31       $keys = array_keys($this->visits['products']);
32       unset($this->visits['products'][$keys[0]]);
33       $this->debug[] = 'unsetted ' . $keys[0]; 
34      }
35
36      if (SERVICE_RECENTLY_VISITED_ORIGINAL_PAGE == 'True') {
37       $this->visits['products'][] = array('products_id' => $id,
38                                           'page_name' => basename($_SERVER['PHP_SELF']),
39                                           'get_params' => tep_array_to_string($_GET, array($osC_Session->name, 'action', 'products_id'))
40                                          );
41      } else {
42       $this->visits['products'][] = array('products_id' => $id);
43      }
44    }
45
46    function setCategory() {
47     if (!empty($_GET['cPath'])) {
48
49      $cpath = $_GET['cPath'];
50
51      foreach ($this->visits['categories'] as $key => $value) {
52       if ($this->visits['categories'][$key]['cpath'] == $cpath) {
53        unset($this->visits['categories'][$key]);
54        break;
55       }
56      }
57
58      if (sizeof($this->visits['categories']) >= MAX_RECENTLY_VISITED_CATEGORIES+3) {
59       $keys = array_keys($this->visits['categories']);
60       unset($this->visits['categories'][$keys[0]]);
61      }
62
63       $this->visits['categories'][] = array('cpath' => $cpath);
64
65     }
66    }
67
68    function setSearchQuery() {
69     if (!empty($_GET['keywords'])) {
70
71      $keywords = $_GET['keywords'];
72
73      foreach ($this->visits['searches'] as $key => $value) {
74       if ($this->visits['searches'][$key]['keywords'] == $keywords) {
75        unset($this->visits['searches'][$key]);
76        break;
77       }
78      }
79
80      if (sizeof($this->visits['searches']) >= MAX_RECENTLY_VISITED_SEARCHES+3) {
81       $keys = array_keys($this->visits['searches']);
82       unset($this->visits['searches'][$keys[0]]);
83      }
84      $this->visits['searches'][] = array('keywords' => $keywords,
85                                          'get_params' => tep_array_to_string($_GET, array($osC_Session->name, 'keywords')));
86     }
87    }
88
89  }
90 ?>
    \ No newline at end of file