phpBMS

Show
Ignore:
Timestamp:
04/07/09 11:44:18 (3 years ago)
Author:
nate
Message:
  • Merged Nathan branch back into trunk.
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/phpbms/modules/sample/install/install.php

    r285 r485  
    11<?php 
    2 /* 
    3  $Rev: 265 $ | $LastChangedBy: brieb $ 
    4  $LastChangedDate: 2007-08-13 21:33:23 -0600 (Mon, 13 Aug 2007) $ 
    5  +-------------------------------------------------------------------------+ 
    6  | Copyright (c) 2004 - 2007, Kreotek LLC                                  | 
    7  | All rights reserved.                                                    | 
    8  +-------------------------------------------------------------------------+ 
    9  |                                                                         | 
    10  | Redistribution and use in source and binary forms, with or without      | 
    11  | modification, are permitted provided that the following conditions are  | 
    12  | met:                                                                    | 
    13  |                                                                         | 
    14  | - Redistributions of source code must retain the above copyright        | 
    15  |   notice, this list of conditions and the following disclaimer.         | 
    16  |                                                                         | 
    17  | - Redistributions in binary form must reproduce the above copyright     | 
    18  |   notice, this list of conditions and the following disclaimer in the   | 
    19  |   documentation and/or other materials provided with the distribution.  | 
    20  |                                                                         | 
    21  | - Neither the name of Kreotek LLC nor the names of its contributore may | 
    22  |   be used to endorse or promote products derived from this software     | 
    23  |   without specific prior written permission.                            | 
    24  |                                                                         | 
    25  | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS     | 
    26  | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT       | 
    27  | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A | 
    28  | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT      | 
    29  | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,   | 
    30  | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT        | 
    31  | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,   | 
    32  | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY   | 
    33  | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT     | 
    34  | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE   | 
    35  | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.    | 
    36  |                                                                         | 
    37  +-------------------------------------------------------------------------+ 
    38 */ 
    39 error_reporting(E_ALL); 
    40 define("APP_DEBUG",false); 
    41 define("noStartup",true); 
    42 include("../../../install/install_include.php"); 
    43 include("../../../include/session.php"); 
     2// The install proceess is typically simple, but if you have some complex 
     3// installation procedures not covered by the installModuleAjax (located in the 
     4// main install/installajax.php file) You can override the class. 
     5// 
     6// Just make sure your class has an 'install' method, and spits back JSON paired 
     7// results 
    448 
    45         $phpbmsSession = new phpbmsSession; 
    46         $success = $phpbmsSession->loadDBSettings(false); 
    47         include_once("include/db.php"); 
    48         $db = new db(false); 
    49         $db->stopOnError = false; 
    50         $db->showError = false; 
    51         $db->logError = false; 
     9// Always instanciate the class to the variable $theModule. include the 
     10// encapsulating objects db and phpbmsSession variables as well 
     11// as the path form the application to the modules's install folder 
     12$theModule = new installModuleAjax($this->db, $this->phpbmsSession, "../modules/sample/install/"); 
    5213 
    53         if($success !== false){ 
    54                  
    55                 if(!$db->connect()) 
    56                         $thereturn = "Could Not Establish Connection To MySQL Server: Check server, user name, and password.";                   
    57                 else { 
    58                         if(!$db->selectSchema()) 
    59                                 $thereturn = "Database (schema) ".MYSQL_DATABASE." could not be selected";                       
    60                         else { 
     14// by default the install class will try to run a createtables.sql file located 
     15// in the modules install directory.  In addition, it will run individual 
     16// SQL files that match table name entries in the tables array (defined below) 
     17// that should also be located in the module's install folder. 
     18$theModule->tables = array( 
     19                        "menu", 
     20                        "modules", 
     21                        "roles", 
     22                        "scheduler", 
     23                        "tabledefs", 
     24                        "tablecolumns", 
     25                        "tableoptions", 
     26                        "tablefindoptions", 
     27                        "tablesearchablefields", 
     28                        "tabs", 
     29                        "users", 
     30                        ); 
    6131 
    62  
    63                                 // ENTER YOUR MODULE NAME HERE 
    64                                 $thereturn = "Business Management System Installation\n"; 
    65                                 $thereturn .= "_______________________________________\n"; 
    66                                  
    67                                 //MAKE SURE THERE IS A createtables.sql FILE 
    68                                 //which houses all your SQL create statements 
    69                                 // for any tables you will create. 
    70                                 $tempreturn = createTables($db,"createtables.sql"); 
    71                                  
    72                                 if($tempreturn === true){ 
    73                                          
    74                                         $thereturn.= "Done Creating Tables \n"; 
    75                                          
    76                                          
    77                                         // NEXT, DEFINE AN ARRAY OF TABLE NAMES 
    78                                         // for any tables that need initial data populated. (including existing tables) 
    79                                         // for each table, make sure there 
    80                                         // is a corresponding SQL file 
    81                                         // with insert statements for all the records needing to be imported 
    82                                         $tables = array( 
    83                                                 "choices", 
    84                                                 "menu", 
    85                                                 "tabs", 
    86                                                 "modules", 
    87                                                 "relationships", 
    88                                                 "reports", 
    89                                                 "tablecolumns", 
    90                                                 "tabledefs", 
    91                                                 "tablefindoptions", 
    92                                                 "tableoptions", 
    93                                                 "tablesearchablefields", 
    94                                                 "usersearches", 
    95                                                 "settings", 
    96                                                 "shippingmethods", 
    97                                                 "paymentmethods",                
    98                                                 "invoicestatuses",               
    99                                         ); 
    100                                         foreach($tables as $table){ 
    101                                                  
    102                                                 $failure = false; 
    103                                                 $tempreturn = importData($db,$table); 
    104                                                 $thereturn .= $tempreturn; 
    105                                                 if(!strpos($tempreturn,"complete.") === false){ 
    106                                                         $failed = true; 
    107                                                 } 
    108                                                  
    109                                         }//end foreach 
    110                                          
    111                                          
    112                                         //MAKE SURE TO set the done message for your module. 
    113                                         if(!$failure){ 
    114                                                 $thereturn .= "________________________\n";                      
    115                                                 $thereturn .= "Done Installing BMS Data\n"; 
    116                                         } 
    117                                 } else 
    118                                         $thereturn = $tempreturn;                                
    119                         }                
    120                 } 
    121         } else 
    122                 $thereturn = "Could not access settings.php"; 
    123                  
    124                  
    125                 header('Content-Type: text/xml'); 
    126                 ?><?php echo '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>'; ?> 
    127 <response><?php echo $thereturn?></response> 
     32?> 
phpBMS vulnerability assesment provided by Orvant Inc. Copyright © 2010 Kreotek, LLC. All Rights reserved.