| Server IP : 85.158.181.41 / Your IP : 216.73.217.12 Web Server : Apache System : Linux cloud9-vm129 6.1.178+1-ph #ph SMP PREEMPT_DYNAMIC Wed Jul 29 09:00:54 UTC 2026 x86_64 User : moncbefd ( 1024) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/moncbefd/www.moneta.at/includes/classes/ |
Upload File : |
<?php
/* --------------------------------------------------------------
message_stack.php 2017-10-18
Gambio GmbH
http://www.gambio.de
Copyright (c) 2017 Gambio GmbH
Released under the GNU General Public License (Version 2)
[http://www.gnu.org/licenses/gpl-2.0.html]
--------------------------------------------------------------
based on:
(c) 2000-2001 The Exchange Project (earlier name of osCommerce)
(c) 2002-2003 osCommerce(message_stack.php,v 1.1 2003/05/19); www.oscommerce.com
(c) 2003 nextcommerce (message_stack.php,v 1.9 2003/08/13); www.nextcommerce.org
(c) 2003 XT-Commerce - community made shopping http://www.xt-commerce.com ($Id: message_stack.php 799 2005-02-23 18:08:06Z novalis $)
Released under the GNU General Public License
-----------------------------------------------------------------------------------------
Example usage:
$messageStack = new messageStack();
$messageStack->add('general', 'Error: Error 1', 'error');
$messageStack->add('general', 'Error: Error 2', 'warning');
if ($messageStack->size('general') > 0) echo $messageStack->output('general');
--------------------------------------------------------------------------------------- */
require_once DIR_FS_CATALOG . 'includes/classes/boxes.php';
class messageStack_ORIGIN extends tableBox {
// class constructor
public function __construct() {
$this->messages = array();
if (isset($_SESSION['messageToStack'])) {
for ($i=0, $n=sizeof($_SESSION['messageToStack']); $i<$n; $i++) {
$this->add($_SESSION['messageToStack'][$i]['class'], $_SESSION['messageToStack'][$i]['text'], $_SESSION['messageToStack'][$i]['type']);
}
unset($_SESSION['messageToStack']);
}
}
// class methods
function add($class, $message, $type = 'error') {
if ($type == 'error') {
$this->messages[] = array('params' => 'class="messageStackError"', 'class' => $class, 'text' => xtc_image(DIR_WS_ICONS . 'error.gif', ICON_ERROR) . ' ' . $message);
} elseif ($type == 'warning') {
$this->messages[] = array('params' => 'class="messageStackWarning"', 'class' => $class, 'text' => xtc_image(DIR_WS_ICONS . 'warning.gif', ICON_WARNING) . ' ' . $message);
} elseif ($type == 'success') {
$this->messages[] = array('params' => 'class="messageStackSuccess"', 'class' => $class, 'text' => xtc_image(DIR_WS_ICONS . 'success.gif', ICON_SUCCESS) . ' ' . $message);
} else {
$this->messages[] = array('params' => 'class="messageStackError"', 'class' => $class, 'text' => $message);
}
}
function add_session($class, $message, $type = 'error') {
if (!isset($_SESSION['messageToStack'])) {
$_SESSION['messageToStack'] = array();
}
$_SESSION['messageToStack'][] = array('class' => $class, 'text' => $message, 'type' => $type);
}
function reset() {
$this->messages = array();
}
function output($class) {
$this->table_data_parameters = 'class="messageBox"';
$output = array();
for ($i=0, $n=sizeof($this->messages); $i<$n; $i++) {
if ($this->messages[$i]['class'] == $class) {
$output[] = $this->messages[$i];
}
}
return $this->get_table_box_string($output);
}
function size($class) {
$count = 0;
for ($i=0, $n=sizeof($this->messages); $i<$n; $i++) {
if ($this->messages[$i]['class'] == $class) {
$count++;
}
}
return $count;
}
}