Subversion-Projekte lars-tiefland.php_share

Revision

Blame | Letzte Änderung | Log anzeigen | RSS feed

<?php
/* $Id: Weban_Shop.class.php 8 2007-04-24 14:17:50Z markus $ */

/**
 * Shop module class. This builds the Base class for
 * the shop module and is created for further updates.
 *
 * This class handles the traffic between a client and the 
 * server. My clou is to put any used Function in a Method
 * formate and replace them with the original.
 *
 * PHP versions 4 and 5
 *
 * LICENSE: This source file is subject to version 3.0 of the PHP license
 * that is available through the world-wide-web at the following URI:
 * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
 * the PHP License and are unable to obtain it through the web, please
 * send a note to license@php.net so we can mail you a copy immediately.
 *
 * @category   Shop
 * @package    Error
 * @author     Markus Niewerth <markus@weban.de>
 * @copyright  1997-2005 The PHP Group
 * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
 * @since      File available since Release 1.0.1
 */
 
 
// {{{ constants


// }}}
// {{{ GLOBALS
 
 // -------------------
 // IF any put in here!
 // -------------------
 
// }}}
// {{{ Error

/**
 * Dies bildet die Basis Klasse f�r das Shop Modul.
 *
 * Diese Klasse bildet die Schnittstelle zwischen dem Client
 * und dem Server und wird die Funktionssyntax abl�sen.
 * Neue Funktionen werden nur noch in Form von Methoden 
 * implementiert. Alle �lteren Funktionen sollten wenn m�glich 
 * hier als Methoden implementiert werden.
 *
 * Funktionen k�nnen aber auch in einer Sammlung gekapselt
 * werden. So, dass sie zum Beispiel eine eigene Klasse bilden
 * (sinnvoll bei Datenbank Funktionen)
 *
 * @category   CMS
 * @package    Error
 * @author     Markus Niewerth  <markus@weban.de>
 * @author     Lars Tiefland    <tiefland@weban.de>
 * @copyright  1997-2007 Webagentur Niewerth
 * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
 * @link       http://server2/intranet/3_0.txt
 * @see        Functions
 * @since      Class available since Release 1.1
 */

class Error {

        // {{{ properties
        
        /**
         * The Shops ID number.
         * 
         * Its a very important ID, cause the 
         * ID is saved in any userdefined data-
         * base entry like articles a.s.o.
         *
         * @var int     
     */
        var $shopsId;
        
        /**
         * The Shop language.
         *
         * The Base language is DE. Note that this
         * value could be mixed! But stadard is DE
         *
         * @var         array    
     */
        var $language;
        
        var $errortype;
        
        // }}}
        // {{{ Error()
        
        /**
         * Base Constructor
         *
         * @param       object
         * @param       object  
         * @return      Weban_Shop       
     */
        function Error ($shopsId, $language, $_ereporting=0) 
        {
                //error_reporting($_ereporting);

                $this->shopsId  = $shopsId;
                $this->language = $language;
                
        }
        // }}}
        
        function errorHandler
        ( 
                $errno          = E_USER_ERROR, 
                $errmsg         = 'Userdefined Error Message', 
                $filename       = __FILE__, 
                $linenum        = __LINE__, 
                $vars           = NULL, 
                $adminmail      = 'markus@weban.de', 
                $logfile        = "weban_shop_error%s.log",
                $logdir         = "/logs/php/"
        )
        {
                $identifier     = date("j-m-y");
                $logdir         = $_SESSION['INI']['DOCUMENT_ROOT'].$logdir.$identifier."/";
                
                if (!@is_dir($logdir)) {
                        @mkdir($logdir,0777);
                }
                
                $logfile = sprintf($logdir.$logfile,$identifier);
                
                $vars    = ($vars==NULL) ? $GLOBALS : $vars;
                $_error  = &new Error_Object($errno, $errmsg, $filename, $linenum, $vars, $adminmail, $logfile);
                return $_error;
        }
        
        function isError($_obj)
        {
                if ( get_class ($_obj) === 'error_object' )
                        return true;
                        
                return false;
        }
        
        function printErrors()
        {
                $_walk=1;
                $_ret=NULL;
                if (!isset($GLOBALS['ErrorMessages'])) 
                {
                        return;
                } else {
                        if (sizeof($GLOBALS['ErrorMessages'])>0) 
                        {       
                                foreach ($GLOBALS['ErrorMessages'] AS $_tmpMsg) 
                                {
                                        $_ret .= $_walk++. ". " .$_tmpMsg. "<br>";
                                }
                        }
                }
                return $_ret;
        }
}
// }}}

/*
 * Local variables:
 * tab-width: 4
 * c-basic-offset: 4
 * c-hanging-comment-ender-p: nil
 * End:
 */
?>