| 1 | rodolico | 1 | <?php
 | 
        
           |  |  | 2 |   | 
        
           |  |  | 3 |   global $DATABASE_DEFINITION; // make variable available to all scripts
 | 
        
           |  |  | 4 |   | 
        
           |  |  | 5 |   /*
 | 
        
           | 19 | rodolico | 6 |    * This file is used to override entries in DatabaseDefinition.php
 | 
        
           | 1 | rodolico | 7 |    * which is subject to modifications via the script sql2admin_hash.pl
 | 
        
           |  |  | 8 |    * 
 | 
        
           | 19 | rodolico | 9 |    * While DatabaseDefinition.php is overwritten by that script, this file
 | 
        
           | 1 | rodolico | 10 |    * will not be.
 | 
        
           |  |  | 11 |    * 
 | 
        
           |  |  | 12 |    * Local change should be of the form
 | 
        
           |  |  | 13 |    * $DATABASE_DEFINITION['users']['field info']['id']['display name'] = 'ID';
 | 
        
           |  |  | 14 |    * 
 | 
        
           |  |  | 15 |    * You can also write scripts so, for example, to change the display
 | 
        
           |  |  | 16 |    * name in all tables which have a column named id
 | 
        
           |  |  | 17 |    * 
 | 
        
           |  |  | 18 |    * foreach ( $DATABASE_DEFINITION as $table => $def) {
 | 
        
           |  |  | 19 |    *   if ( isset( $DATABASE_DEFINITION[$table]['field info']['id'] ) ) {
 | 
        
           |  |  | 20 |    *      $DATABASE_DEFINITION[$table]['field info']['id']['display name'] = 'ID';
 | 
        
           |  |  | 21 |    *   }
 | 
        
           |  |  | 22 |    * }
 | 
        
           |  |  | 23 |    * 
 | 
        
           |  |  | 24 |    * 
 | 
        
           | 19 | rodolico | 25 |    * NOTE: you can not redefine  the constants in DatabaseDefinition.php. 
 | 
        
           |  |  | 26 |    * That is why they are called constants. You should comment them 
 | 
        
           |  |  | 27 |    * in database_def.php
 | 
        
           | 1 | rodolico | 28 |    * and then redefine them here. That will throw an error if you then 
 | 
        
           |  |  | 29 |    * rerun sql2admin_hash.pl and forget to comment them out in database_def.php
 | 
        
           |  |  | 30 |    * (error shows up in the apache error log)
 | 
        
           |  |  | 31 |    * 
 | 
        
           |  |  | 32 |    */ 
 | 
        
           |  |  | 33 |   | 
        
           |  |  | 34 |    foreach ( $DATABASE_DEFINITION as $table => $def) {
 | 
        
           | 22 | rodolico | 35 |       if ( isset( $DATABASE_DEFINITION[$table]['field info'][$DATABASE_DEFINITION[$table]['key field']] ) ) {
 | 
        
           |  |  | 36 |          $DATABASE_DEFINITION[$table]['field info'][$DATABASE_DEFINITION[$table]['key field']]['display name'] = 'ID';
 | 
        
           | 1 | rodolico | 37 |       }
 | 
        
           |  |  | 38 |       // go through all display fields and change spaces to underscores
 | 
        
           |  |  | 39 |       // then, for the look up tables, change _id to nothing, so 'Site Id' will become ''Site_Id' and then 'Site'
 | 
        
           |  |  | 40 |       foreach ( $DATABASE_DEFINITION[$table]['field info'] as $fieldName => $definition ) {
 | 
        
           |  |  | 41 |          $DATABASE_DEFINITION[$table]['field info'][$fieldName]['display name'] = str_ireplace( '_id', '', $DATABASE_DEFINITION[$table]['field info'][$fieldName]['display name'] );
 | 
        
           | 22 | rodolico | 42 |          $DATABASE_DEFINITION[$table]['field info'][$fieldName]['display name'] = str_replace( '_', ' ', $DATABASE_DEFINITION[$table]['field info'][$fieldName]['display name'] );
 | 
        
           |  |  | 43 |          if ( ! isset( $DATABASE_DEFINITION[$table]['field info'][$fieldName]['input filter'] ) )
 | 
        
           |  |  | 44 |             $DATABASE_DEFINITION[$table]['field info'][$fieldName]['input filter'] = 'alphanum';
 | 
        
           | 1 | rodolico | 45 |       } // foreach
 | 
        
           |  |  | 46 |    }
 | 
        
           |  |  | 47 |   | 
        
           | 19 | rodolico | 48 |    $DATABASE_DEFINITION['_user']['display query'] = 'select _user_id,username,name,email,notes from _user';
 | 
        
           |  |  | 49 |    $DATABASE_DEFINITION['_user']['field info']['pass']['type'] = 'password';
 | 
        
           | 1 | rodolico | 50 |   | 
        
           | 19 | rodolico | 51 |    $DATABASE_DEFINITION['client']['display query'] = 'select client_id,name from client';
 | 
        
           |  |  | 52 |   | 
        
           | 1 | rodolico | 53 | ?>
 |