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    Database_Check
 * @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
define('__DATABASE_CHECK_SQL_FILES_DIR__',                      '/usr/share/php/module/shop/includes/sqlfiles/');


// }}}
// {{{ GLOBALS
 
 // -------------------
 // IF any put in here!
 // -------------------
 
        /**
         * Table Names
         * 
         * Holds all tablenames that are needed 
         * for a 'redaktions system'
         *
         * @name tables 
         */
         
         $GLOBALS['tables'] = array 
         (
                 'Aktionen' => 
                 
                         array
                         (
                                'ID' => 'int(4)'
                         ),
                         
                 'Bestellung',
                 'Feature_options',
                 'Feature_to_Ware',
                 'Features',
                 'Herstellerkatalog',
                 'Logins',
                 'Logins_to_Verteiler',
                 'Preisagentur',
                 'Preisagentur_regEx',
                 'Verteiler',
                 'WarenTesterLogos',
                 'artikel',
                 'artikel_2_Aktionen',
                 'artikel_to_Bestellung',
                 'artikel_to_Preisagentur',
                 'artikel_to_WarenTesterLogos',
                 'banner',
                 'bannerPositionen',
                 'banner_to_bannerPositionen',
                 'counter',
                 'directory',
                 'eBay_Auktionen',
                 'eBay_AuktionsDaten',
                 'eBay_Bestellung',
                 'eBay_settings',
                 'news',
                 'shop_link_table',
                 'shop_log',
                 'shops',
                 'such_quelle',
                 'such_quelle_to_such_woerter',
                 'such_woerter',
                 'templates',
                 'templates_to_artikel',
                 'templates_to_directory',
                 'top_seller',
                 'top_seller_settings',
                 'top_seller_to_aufrufe',
                 'web_settings',
         );
          
// }}}
// {{{ Weban_Shop

/**
 * 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    Database_Check
 * @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 Database_Check {

        // {{{ 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 $_databaseName;
        
        /**
         * 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 $_tables;   
        
        // }}}
        // {{{ Weban_Shop()
        
        /**
         * Base Constructor
         *
         * @param       object
         * @param       object  
         * @return      Weban_Shop       
     */
        function Database_Check ($_databaseName=1, $_tables=array()) 
        {
                $this->_databaseName = $_databaseName;
                $this->_tables = ($_tables==array()) ? $GLOBALS['tables'] : $_tables;
        }
        // }}}
        
        function chksqldir() 
        {
                if (!is_array($this->_tables)) 
                        return false;
                        
                foreach($this->_tables AS $_tblName) 
                {
                        $_fileName = __DATABASE_CHECK_SQL_FILES_DIR__.$_tblName;
                        if (!is_dir($_fileName)) 
                        {
                                if (!@mkdir ($_fileName, 0700)) 
                                {
                                        print("<hr>Error While Creating Sql Directory: $_fileName<hr>");
                                        $_ret['file_exists'][$_tblName] = 0;
                                        $_ret['sql_string'][$_tblName]  = 0;
                                }  else {
                                        $_ret['file_exists'][$_tblName] = 1;
                                }       
                        } else {
                                $_ret['file_exists'][$_tblName] = 1;
                        }
                        $_ret['sql_string'][$_tblName]  = $this->getSqlCmd ($_fileName);
                }
                return $_ret;
        }
        
        function getSqlCmd ($_fileName)
        {
                return @file_get_contents($_fileName."/sql.php");
        }
        
}
// }}}

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