Changeset 1661 in ExiteCMS for trunk/includes/db_functions.php


Ignore:
Timestamp:
08/21/08 18:31:24 (4 years ago)
Author:
hverton
Message:

further setup updates
new dbsetup_include file
added an option to locale_load() to override the system locale

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/db_functions.php

    r1578 r1661  
    3333 
    3434    $isUserQuery = false; 
    35          
    36     // tables with user information 
    37     $usertables = array("users", "new_users", "user_groups", "bad_login", "online", "blacklist"); 
     35 
     36    // only do this if there's a prefix defined 
     37    if (!empty($db_prefix)) {        
     38        // tables with user information 
     39        $usertables = array("users", "new_users", "user_groups", "bad_login", "online", "blacklist"); 
    3840     
    39     // check if this is a query on a user table 
    40     foreach($usertables as $usertable) { 
    41         if(strpos($query, " ".$db_prefix.$usertable)) { 
    42             $isUserQuery = true; 
    43             $query = str_replace(" ".$db_prefix.$usertable, " ".$user_db_name.".".$user_db_prefix.$usertable, $query); 
    44             $query = str_replace("=".$db_prefix.$usertable, "=".$user_db_name.".".$user_db_prefix.$usertable, $query); 
     41        // check if this is a query on a user table 
     42        foreach($usertables as $usertable) { 
     43            if(strpos($query, " ".$db_prefix.$usertable)) { 
     44                $isUserQuery = true; 
     45                $query = str_replace(" ".$db_prefix.$usertable, " ".$user_db_name.".".$user_db_prefix.$usertable, $query); 
     46                $query = str_replace("=".$db_prefix.$usertable, "=".$user_db_name.".".$user_db_prefix.$usertable, $query); 
     47            } 
    4548        } 
    46     } 
    47     // prefix all other tables with the database name as well 
    48     $query = str_replace(" ".$db_prefix, " ".$db_name.".".$db_prefix, $query); 
    49      
     49        // prefix all other tables with the database name as well 
     50        $query = str_replace(" ".$db_prefix, " ".$db_name.".".$db_prefix, $query); 
     51    } 
     52 
    5053    // and return the result 
    5154    return $isUserQuery; 
Note: See TracChangeset for help on using the changeset viewer.