plugins/admin/LangManager.php
author Dan
Wed, 26 Mar 2008 02:56:23 -0400
changeset 509 175df10e0b56
parent 504 bc8e0e9ee01d
child 536 218a627eb53e
permissions -rw-r--r--
Added a copy of Firebug Lite for debugging purposes. License is uncertain but being treated as MPL. (If is is not MPL then it is under something more permissive that permits relicensing anyway)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
372
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
     1
<?php
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
     2
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
     3
/*
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
     4
 * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
504
bc8e0e9ee01d Added support for embedding language data into plugins; updated all version numbers on plugin files
Dan
parents: 411
diff changeset
     5
 * Version 1.1.3 (Caoineag alpha 3)
372
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
     6
 * Copyright (C) 2006-2007 Dan Fuhry
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
     7
 *
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
     8
 * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
     9
 * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    10
 *
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    11
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    12
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    13
 */
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    14
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    15
function page_Admin_LangManager()
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    16
{
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    17
  global $db, $session, $paths, $template, $plugins; // Common objects
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    18
  global $lang;
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    19
  if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN )
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    20
  {
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    21
    $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true);
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    22
    echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>';
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    23
    echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>';
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    24
    return;
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    25
  }
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    26
  if ( isset($_POST['action']) )
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    27
  {
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    28
    $action =& $_POST['action'];
376
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
    29
    // Parse parameters
372
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    30
    if ( strpos($action, ';') )
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    31
    {
376
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
    32
      // Parameter section
372
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    33
      $parms = substr($action, strpos($action, ';') + 1);
376
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
    34
      
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
    35
      // Action name section
372
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    36
      $action = substr($action, 0, strpos($action, ';'));
376
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
    37
      
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
    38
      // Match all parameters
372
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    39
      preg_match_all('/([a-z0-9_]+)=(.+?)(;|$)/', $parms, $matches);
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    40
      $parms = array();
376
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
    41
      
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
    42
      // For each full parameter, assign $parms an associative value
372
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    43
      foreach ( $matches[0] as $i => $_ )
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    44
      {
376
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
    45
        $parm = $matches[2][$i];
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
    46
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
    47
        // Is this parameter in the form of an integer?
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
    48
        // (designed to ease validation later)
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
    49
        if ( preg_match('/^[0-9]+$/', $parm) )
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
    50
          // Yes, run intval(), this enabling is_int()-ish checks
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
    51
          $parm = intval($parm);
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
    52
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
    53
        $parms[$matches[1][$i]] = $parm;
372
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    54
      }
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    55
    }
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    56
    switch ( $action )
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    57
    {
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    58
      case 'install_language':
399
a3a9e463c62f Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents: 387
diff changeset
    59
        
a3a9e463c62f Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents: 387
diff changeset
    60
        if ( defined('ENANO_DEMO_MODE') )
a3a9e463c62f Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents: 387
diff changeset
    61
        {
a3a9e463c62f Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents: 387
diff changeset
    62
          echo '<div class="error-box">' . $lang->get('acplm_err_lang_install_demo') . '</div>';
a3a9e463c62f Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents: 387
diff changeset
    63
          break;
a3a9e463c62f Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents: 387
diff changeset
    64
        }
a3a9e463c62f Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents: 387
diff changeset
    65
        
372
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    66
        $lang_list = list_available_languages();
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    67
        // Verify that we have this language's metadata
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    68
        if ( isset($lang_list[@$parms['iso639']]) )
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    69
        {
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    70
          // From here it's all downhill :-)
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    71
          $lang_code =& $parms['iso639'];
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    72
          $lang_data =& $lang_list[$lang_code];
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    73
          
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    74
          $result = install_language($lang_code, $lang_data['name_eng'], $lang_data['name']);
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    75
          if ( $result )
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    76
          {
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    77
            // Language installed. Import the language files.
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    78
            $lang_local = new Language($lang_code);
376
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
    79
            if ( file_exists(ENANO_ROOT . "/language/{$lang_data['dir']}/backup.json") )
372
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    80
            {
376
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
    81
              $lang_local->import(ENANO_ROOT . "/language/{$lang_data['dir']}/backup.json");
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
    82
            }
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
    83
            else
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
    84
            {
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
    85
              foreach ( array('core', 'admin', 'tools', 'user') as $file )
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
    86
              {
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
    87
                $lang_local->import(ENANO_ROOT . "/language/{$lang_data['dir']}/$file.json");
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
    88
              }
372
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    89
            }
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    90
            unset($lang_local);
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    91
            
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    92
            echo '<div class="info-box">' . $lang->get('acplm_msg_lang_install_success', array('lang_name' => htmlspecialchars($lang_data['name_eng']))) . '</div>';
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    93
          }
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    94
        }
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
    95
        break;
376
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
    96
      case 'modify_language':
399
a3a9e463c62f Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents: 387
diff changeset
    97
        
376
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
    98
        $lang_id =& $parms['lang_id'];
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
    99
        if ( !is_int($lang_id) )
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   100
        {
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   101
          echo 'Hacking attempt';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   102
          break;
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   103
        }
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   104
        
400
7eef739a5b81 A few hacks to make the 1.1 demo plugin work
Dan
parents: 399
diff changeset
   105
        if ( isset($parms['finish']) && !empty($_POST['lang_name_native']) && !empty($_POST['lang_name_english']) && !defined('ENANO_DEMO_MODE') )
376
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   106
        {
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   107
          // We just did validation above, it's safe to save.
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   108
          $name_native = $db->escape($_POST['lang_name_native']);
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   109
          $name_english = $db->escape($_POST['lang_name_english']);
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   110
          
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   111
          $q = $db->sql_query('UPDATE ' . table_prefix . "language SET lang_name_native = '$name_native', lang_name_default = '$name_english' WHERE lang_id = $lang_id;");
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   112
          if ( !$q )
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   113
            $db->_die();
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   114
          
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   115
          echo '<div class="info-box">' . $lang->get('acplm_msg_basic_save_success') . '</div>';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   116
        }
400
7eef739a5b81 A few hacks to make the 1.1 demo plugin work
Dan
parents: 399
diff changeset
   117
        else if ( isset($parms['finish']) && defined('ENANO_DEMO_MODE') )
7eef739a5b81 A few hacks to make the 1.1 demo plugin work
Dan
parents: 399
diff changeset
   118
        {
7eef739a5b81 A few hacks to make the 1.1 demo plugin work
Dan
parents: 399
diff changeset
   119
          echo '<div class="error-box">' . $lang->get('acplm_err_lang_install_demo') . '</div>';
7eef739a5b81 A few hacks to make the 1.1 demo plugin work
Dan
parents: 399
diff changeset
   120
        }
376
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   121
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   122
        // Select language data
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   123
        $q = $db->sql_query('SELECT lang_name_native, lang_name_default, lang_code FROM ' . table_prefix . "language WHERE lang_id = $lang_id;");
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   124
        if ( !$q )
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   125
          $db->_die();
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   126
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   127
        list($name_native, $name_english, $lang_code) = $db->fetchrow_num();
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   128
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   129
        // Output properties table
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   130
        echo '<h3>' . $lang->get('acplm_heading_modify') . '</h3>';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   131
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   132
        acp_start_form();
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   133
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   134
        ?>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   135
          <div class="tblholder">
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   136
            <table border="0" cellspacing="1" cellpadding="4">
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   137
              <tr>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   138
                <th colspan="2">
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   139
                  <?php
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   140
                    echo $lang->get('acplm_th_lang_basic');
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   141
                  ?>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   142
                </th>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   143
              </tr>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   144
              <tr>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   145
              <td class="row2" style="width: 50%;">
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   146
                  <?php
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   147
                    echo str_replace('"', '', $lang->get('acplm_field_lang_name_native'));
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   148
                  ?>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   149
                </td>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   150
                <td class="row1">
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   151
                  <input type="text" name="lang_name_native" value="<?php echo htmlspecialchars($name_native); ?>" />
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   152
                </td>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   153
              </tr>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   154
              <tr>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   155
                <td class="row2">
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   156
                  <?php
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   157
                    echo $lang->get('acplm_field_lang_name_english');
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   158
                  ?>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   159
                </td>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   160
                <td class="row1">
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   161
                  <input type="text" name="lang_name_english" value="<?php echo htmlspecialchars($name_english); ?>" />
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   162
                </td>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   163
              </tr>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   164
              <tr>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   165
                <td class="row2">
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   166
                  <?php
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   167
                    echo $lang->get('acplm_field_lang_code') . '<br />'
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   168
                       . '<small>' . $lang->get('acplm_field_lang_code_hint') . '</small>';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   169
                  ?>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   170
                </td>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   171
                <td class="row1">
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   172
                  <?php
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   173
                    echo $lang_code;
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   174
                  ?>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   175
                </td>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   176
              </tr>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   177
              <tr>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   178
                <th class="subhead" colspan="2">
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   179
                  <button name="action" value="modify_language;finish=1;lang_id=<?php echo $lang_id; ?>"><?php echo $lang->get('etc_save_changes'); ?></button>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   180
                </th>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   181
              </tr>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   182
            </table>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   183
          </div>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   184
        </form>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   185
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   186
        <?php
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   187
        acp_start_form();
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   188
        ?>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   189
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   190
        <h3><?php echo $lang->get('acplm_heading_edit_strings_portal'); ?></h3>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   191
        <p><?php echo $lang->get('acplm_msg_edit_strings_portal_intro'); ?></p>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   192
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   193
        <p>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   194
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   195
        <?php
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   196
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   197
        // Grab a Language object
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   198
        if ( $lang->lang_id == $lang_id )
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   199
        {
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   200
          $lang_local =& $lang;
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   201
        }
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   202
        else
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   203
        {
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   204
          $lang_local = new Language($lang_id);
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   205
          $lang_local->fetch();
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   206
        }
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   207
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   208
        $categories_loc = array();
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   209
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   210
        // Using the & here ensures that a reference is created, thus avoiding wasting memory
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   211
        foreach ( $lang_local->strings as $cat => &$_ )
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   212
        {
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   213
          unset($_);
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   214
          $categories_loc[$cat] = htmlspecialchars($lang->get("meta_$cat"));
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   215
        }
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   216
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   217
        asort($categories_loc);
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   218
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   219
        echo '<select name="cat_id">';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   220
        foreach ( $categories_loc as $cat_id => $cat_name)
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   221
        {
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   222
          echo "<option value=\"$cat_id\">$cat_name</option>";
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   223
        }
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   224
        echo '</select>';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   225
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   226
        ?>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   227
        <button name="action" value="edit_strings;lang_id=<?php echo $lang_id; ?>">
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   228
          <?php echo $lang->get('acplm_btn_edit_strings_portal'); ?>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   229
        </button>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   230
        </p>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   231
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   232
        <h3><?php echo $lang->get('acplm_heading_reimport_portal'); ?></h3>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   233
        <p><?php echo $lang->get('acplm_msg_reimport_portal_intro'); ?></p>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   234
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   235
        <p>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   236
          <button name="action" value="reimport;iso639=<?php echo $lang_code; ?>;lang_id=<?php echo $lang_id; ?>">
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   237
            <?php echo $lang->get('acplm_btn_reimport'); ?>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   238
          </button>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   239
        </p>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   240
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   241
        </form>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   242
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   243
        <?php
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   244
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   245
        echo '<h3>' . $lang->get('acplm_heading_backup') . '</h3>';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   246
        echo '<p>' . $lang->get('acplm_backup_intro') . '</p>';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   247
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   248
        echo '<form action="' . makeUrlNS('Admin', 'LangManager') . '" method="post">';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   249
        echo '<button name="action" value="backup_language;lang_id=' . $lang_id . '">' . $lang->get('acplm_btn_create_backup') . '</button>';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   250
        echo '</form>';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   251
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   252
        return true;
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   253
      case 'edit_strings':
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   254
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   255
        $cat_id = @$_POST['cat_id'];
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   256
        if ( !preg_match('/^[a-z0-9]+$/', $cat_id) || !is_int(@$parms['lang_id']) )
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   257
          break;
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   258
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   259
        $lang_id =& $parms['lang_id'];
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   260
        
399
a3a9e463c62f Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents: 387
diff changeset
   261
        if ( isset($parms['save']) && !defined('ENANO_DEMO_MODE') )
376
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   262
        {
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   263
          // Grab a Language object
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   264
          if ( $lang->lang_id == $lang_id )
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   265
          {
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   266
            $lang_local =& $lang;
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   267
          }
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   268
          else
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   269
          {
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   270
            $lang_local = new Language($lang_id);
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   271
          }
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   272
          // Main save loop
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   273
          // Trying to minimize queries as much as possible here, but you know how that goes.
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   274
          $count_upd = 0;
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   275
          foreach ( $_POST['string'] as $string_id => $user_content )
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   276
          {
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   277
            $curr_content = $lang_local->get_uncensored("{$cat_id}_{$string_id}");
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   278
            if ( $curr_content != $user_content )
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   279
            {
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   280
              $count_upd++;
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   281
              $user_content = $db->escape($user_content);
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   282
              $string_id = $db->escape($string_id);
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   283
              $q = $db->sql_query('UPDATE ' . table_prefix . "language_strings SET string_content = '$user_content' WHERE lang_id = $lang_id AND string_category = '$cat_id' AND string_name = '$string_id';");
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   284
              if ( !$q )
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   285
                $db->_die();
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   286
            }
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   287
          }
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   288
          if ( $count_upd > 0 )
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   289
          {
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   290
            // Update the cache
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   291
            $lang_local->regen_caches();
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   292
            
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   293
            // Update modification time
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   294
            $q = $db->sql_query('UPDATE ' . table_prefix . "language SET last_changed = " . time() . " WHERE lang_id = $lang_id;");
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   295
            if ( !$q )
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   296
              $db->_die();
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   297
          }
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   298
          
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   299
          echo '<div class="info-box">' . $lang->get('acplm_msg_string_save_success') . '</div>';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   300
        }
399
a3a9e463c62f Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents: 387
diff changeset
   301
        else if ( isset($parms['save']) && defined('ENANO_DEMO_MODE') )
a3a9e463c62f Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents: 387
diff changeset
   302
        {
a3a9e463c62f Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents: 387
diff changeset
   303
          echo '<div class="error-box">' . $lang->get('acplm_err_lang_install_demo') . '</div>';
a3a9e463c62f Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents: 387
diff changeset
   304
        }
376
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   305
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   306
        acp_start_form();
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   307
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   308
        $cat_name = $lang->get("meta_$cat_id");
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   309
        echo '<h3>' . $lang->get('acplm_editor_heading', array('cat_name' => $cat_name)) . '</h3>';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   310
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   311
        // Fetch all strings
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   312
        // This is more efficient than iterating through $lang->strings, I think.
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   313
        $q = $db->sql_query('SELECT string_id, string_name, string_content FROM ' . table_prefix . "language_strings WHERE string_category = '$cat_id' AND lang_id = $lang_id;");
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   314
        if ( !$q )
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   315
          $db->_die();
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   316
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   317
        ?>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   318
        <div class="tblholder">
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   319
          <table border="0" cellspacing="1" cellpadding="4">
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   320
            <tr>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   321
              <th style="width: 3%;"><?php echo $lang->get('acplm_editor_col_string_name'); ?></th>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   322
              <th><?php echo $lang->get('acplm_editor_col_string_content'); ?></th>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   323
            </tr>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   324
        <?php
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   325
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   326
        while ( $row = $db->fetchrow_num() )
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   327
        {
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   328
          list($string_id, $string_name, $string_content) = $row;
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   329
          unset($row);
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   330
          
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   331
          echo '<tr>';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   332
          
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   333
          if ( strpos($string_content, "\n") )
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   334
          {
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   335
            $editor = '<textarea rows="' . get_line_count($string_content) . '" cols="50" style="width: 99%;" ';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   336
            $editor .= 'name="string[' . htmlspecialchars($string_name) . ']" ';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   337
            $editor .= '>' . htmlspecialchars($string_content);
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   338
            $editor .= '</textarea>';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   339
          }
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   340
          else
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   341
          {
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   342
            $editor = '<input type="text" size="50" style="width: 99%;" ';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   343
            $editor .= 'name="string[' . htmlspecialchars($string_name) . ']" ';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   344
            $editor .= 'value="' . htmlspecialchars($string_content) . '" ';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   345
            $editor .= '/>';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   346
          }
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   347
          
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   348
          echo '<td class="row2">' . htmlspecialchars($string_name) . '</td>';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   349
          echo '<td class="row1">' . $editor . '</td>';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   350
          
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   351
          
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   352
          echo '</tr>';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   353
          echo "\n";
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   354
        }
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   355
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   356
        echo '<tr>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   357
                <th class="subhead" colspan="2">';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   358
                
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   359
        echo '<input type="hidden" name="cat_id" value="' . $cat_id . '" />';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   360
                
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   361
        // Button: save
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   362
        echo '<button name="action" value="edit_strings;lang_id=' . $lang_id . ';save=1" style="font-weight: bold;">' . $lang->get('etc_save_changes') . '</button> ';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   363
        // Button: revert
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   364
        echo '<button name="action" value="edit_strings;lang_id=' . $lang_id . '" style="font-weight: normal;">' . $lang->get('acplm_editor_btn_revert') . '</button> ';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   365
        // Button: cancel
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   366
        echo '<button name="action" value="modify_language;lang_id=' . $lang_id . '" style="font-weight: normal;">' . $lang->get('acplm_editor_btn_cancel') . '</button>';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   367
                
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   368
        echo '  </th>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   369
              </tr>';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   370
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   371
        ?>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   372
          </table>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   373
        </div>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   374
        <?php
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   375
        echo '</form>';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   376
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   377
        return true;
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   378
      case 'reimport':
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   379
        if ( !isset($parms['iso639']) || !is_int(@$parms['lang_id']) )
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   380
          break;
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   381
        
399
a3a9e463c62f Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents: 387
diff changeset
   382
        if ( defined('ENANO_DEMO_MODE') )
a3a9e463c62f Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents: 387
diff changeset
   383
        {
a3a9e463c62f Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents: 387
diff changeset
   384
          echo '<div class="error-box">' . $lang->get('acplm_err_lang_install_demo') . '</div>';
a3a9e463c62f Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents: 387
diff changeset
   385
          break;
a3a9e463c62f Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents: 387
diff changeset
   386
        }
a3a9e463c62f Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents: 387
diff changeset
   387
        
376
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   388
        $lang_code =& $parms['iso639'];
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   389
        $lang_id =& $parms['lang_id'];
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   390
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   391
        $lang_list = list_available_languages();
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   392
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   393
        if ( !isset($lang_list[$lang_code]) )
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   394
          break;
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   395
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   396
        // Grab a Language object
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   397
        if ( $lang->lang_id == $lang_id )
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   398
        {
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   399
          $lang_local =& $lang;
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   400
        }
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   401
        else
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   402
        {
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   403
          $lang_local = new Language($lang_id);
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   404
        }
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   405
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   406
        $lang_data =& $lang_list[$lang_code];
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   407
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   408
        // This is the big re-import loop
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   409
        if ( file_exists(ENANO_ROOT . "/language/{$lang_data['dir']}/backup.json") )
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   410
        {
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   411
          $lang_local->import(ENANO_ROOT . "/language/{$lang_data['dir']}/backup.json");
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   412
        }
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   413
        else
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   414
        {
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   415
          foreach ( array('core', 'admin', 'tools', 'user') as $file )
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   416
          {
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   417
            $lang_local->import(ENANO_ROOT . "/language/{$lang_data['dir']}/$file.json");
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   418
          }
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   419
        }
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   420
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   421
        echo '<div class="info-box">' . $lang->get('acplm_msg_reimport_success') . '</div>';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   422
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   423
        break;
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   424
      case 'backup_language':
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   425
        if ( !is_int(@$parms['lang_id']) )
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   426
          break;
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   427
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   428
        $lang_id =& $parms['lang_id'];
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   429
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   430
        // Grab a Language object
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   431
        if ( $lang->lang_id == $lang_id )
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   432
        {
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   433
          $lang_local =& $lang;
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   434
        }
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   435
        else
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   436
        {
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   437
          $lang_local = new Language($lang_id);
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   438
        }
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   439
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   440
        $filename = 'enano_lang_' . $lang_local->lang_code . '_' . enano_date('ymd') . '.json';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   441
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   442
        // Free as much memory as possible
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   443
        $db->close();
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   444
        unset($GLOBALS['session'], $GLOBALS['paths'], $GLOBALS['template'], $GLOBALS['plugins']);
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   445
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   446
        // HTTP headers
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   447
        header('Content-type: application/json');
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   448
        header('Content-disposition: attachment; filename=' . $filename);
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   449
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   450
        // Export to JSON
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   451
        $lang_struct = array(
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   452
            'categories' => array_keys($lang_local->strings),
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   453
            'strings' => $lang_local->strings
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   454
          );
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   455
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   456
        $lang_struct = enano_json_encode($lang_struct);
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   457
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   458
        header('Content-length: ' . strlen($lang_struct));
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   459
        echo $lang_struct;
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   460
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   461
        exit;
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   462
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   463
      case 'uninstall_language':
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   464
        if ( !is_int(@$parms['lang_id']) )
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   465
          break;
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   466
        
399
a3a9e463c62f Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents: 387
diff changeset
   467
        if ( defined('ENANO_DEMO_MODE') )
a3a9e463c62f Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents: 387
diff changeset
   468
        {
a3a9e463c62f Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents: 387
diff changeset
   469
          echo '<div class="error-box">' . $lang->get('acplm_err_lang_install_demo') . '</div>';
a3a9e463c62f Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents: 387
diff changeset
   470
          break;
a3a9e463c62f Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents: 387
diff changeset
   471
        }
a3a9e463c62f Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents: 387
diff changeset
   472
        
376
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   473
        $lang_id =& $parms['lang_id'];
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   474
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   475
        if ( isset($parms['confirm']) )
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   476
        {
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   477
          $lang_default = intval(getConfig('default_language'));
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   478
          if ( $lang_default == $lang_id )
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   479
          {
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   480
            echo '<div class="error-box">' . $lang->get('acplm_err_cant_uninstall_default') . '</div>';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   481
            break;
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   482
          }
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   483
          if ( $lang_id == $lang->lang_id )
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   484
          {
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   485
            // Unload the current language since it's about to be uninstalled
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   486
            unset($lang, $GLOBALS['lang']);
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   487
            $GLOBALS['lang'] = new Language($lang_default);
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   488
            global $lang;
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   489
          }
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   490
          // We're clear
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   491
          
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   492
          // Remove cache files
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   493
          $cache_file = ENANO_ROOT . "/cache/lang_{$lang_id}.php";
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   494
          if ( file_exists($cache_file) )
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   495
            @unlink($cache_file);
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   496
          
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   497
          // Remove strings
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   498
          $q = $db->sql_query('DELETE FROM ' . table_prefix . "language_strings WHERE lang_id = $lang_id;");
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   499
          if ( !$q )
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   500
            $db->_die();
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   501
          
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   502
          // Delete the language
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   503
          $q = $db->sql_query('DELETE FROM ' . table_prefix . "language WHERE lang_id = $lang_id;");
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   504
          if ( !$q )
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   505
            $db->_die();
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   506
          
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   507
          echo '<div class="info-box">' . $lang->get('acplm_msg_uninstall_success') . '</div>';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   508
          break;
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   509
        }
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   510
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   511
        acp_start_form();
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   512
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   513
        echo '<h3>' . $lang->get('acplm_uninstall_confirm_title') . '</h3>';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   514
        echo '<p>' . $lang->get('acplm_uninstall_confirm_body') . '</p>';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   515
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   516
        echo '<p><button name="action" style="font-weight: bold;" value="uninstall_language;lang_id=' . $lang_id . ';confirm=1">' . $lang->get('acplm_btn_uninstall_confirm') . '</button> ';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   517
        echo '<button name="action" value="home">' . $lang->get('acplm_btn_uninstall_cancel') . '</button></p>';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   518
        
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   519
        echo '</form>';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   520
        return true;
372
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   521
    }
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   522
  }
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   523
  
376
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   524
  acp_start_form();
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   525
  
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   526
  // Select current languages
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   527
  $q = $db->sql_query('SELECT lang_code, lang_name_native, lang_name_default, lang_id FROM ' . table_prefix . "language ORDER BY lang_id ASC;");
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   528
  if ( !$q )
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   529
    $db->_die();
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   530
  
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   531
  // Language properties/edit/delete portal table
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   532
  echo '<h3>' . $lang->get('acplm_heading_editor_portal') . '</h3>';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   533
  
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   534
  echo '<div class="tblholder">';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   535
  echo '<table border="0" cellspacing="1" cellpadding="4">';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   536
  echo '<tr>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   537
          <th>' . $lang->get('acplm_col_lang_id') . '</th>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   538
          <th>' . $lang->get('acplm_col_lang_code') . '</th>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   539
          <th>' . $lang->get('acplm_col_lang_name') . '</th>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   540
          <th>' . $lang->get('acplm_col_lang_name_eng') . '</th>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   541
          <th></th>
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   542
        </tr>';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   543
  
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   544
  $cls = 'row2';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   545
  
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   546
  $btn_edit = $lang->get('acplm_portal_btn_edit');
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   547
  $btn_unin = $lang->get('acplm_portal_btn_unin');
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   548
  
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   549
  while ( $row = $db->fetchrow($q) )
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   550
  {
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   551
    $cls = ( $cls == 'row1' ) ? 'row2' : 'row1';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   552
    
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   553
    echo '<tr>';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   554
    
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   555
    $lang_code = htmlspecialchars($row['lang_code']);
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   556
    $lang_name_native  = htmlspecialchars($row['lang_name_native']);
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   557
    $lang_name_english = htmlspecialchars($row['lang_name_default']);
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   558
    
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   559
    echo "<td class=\"$cls\" style=\"text-align: center;\">{$row['lang_id']}</td>";
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   560
    echo "<td class=\"$cls\" style=\"text-align: center;\">{$lang_code}</td>";
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   561
    echo "<td class=\"$cls\" style=\"text-align: center;\">{$lang_name_native}</td>";
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   562
    echo "<td class=\"$cls\" style=\"text-align: center;\">{$lang_name_english}</td>";
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   563
    echo "<td class=\"$cls\" style=\"text-align: center;\"><button name=\"action\" value=\"modify_language;lang_id={$row['lang_id']}\">$btn_edit</button> <button name=\"action\" value=\"uninstall_language;lang_id={$row['lang_id']}\">$btn_unin</button></td>";
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   564
    
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   565
    echo '</tr>';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   566
  }
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   567
  
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   568
  echo '</table></div>';
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   569
  
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   570
  // Reset the result pointer to zero so we can fetch that list of languages again
377
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 376
diff changeset
   571
  if ( !$db->sql_data_seek(0, $q) )
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 376
diff changeset
   572
  {
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 376
diff changeset
   573
    $db->_die('LangManager doing seek back to zero for installation blacklist');
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 376
diff changeset
   574
  }
376
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   575
  
372
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   576
  // $lang_list is fetched by the posthandler sometimes
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   577
  if ( !isset($lang_list) )
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   578
  {
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   579
    // Build a list of languages in the languages/ directory, then
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   580
    // eliminate the ones that are already installed.
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   581
    $lang_list = list_available_languages();
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   582
  }
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   583
  
377
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 376
diff changeset
   584
  while ( $row = $db->fetchrow($q) )
372
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   585
  {
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   586
    $lang_code =& $row['lang_code'];
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   587
    if ( isset($lang_list[$lang_code]) )
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   588
    {
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   589
      unset($lang_list[$lang_code]);
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   590
      unset($lang_list[$lang_code]); // PHP <5.1.4 Zend bug
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   591
    }
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   592
  }
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   593
  
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   594
  if ( count($lang_list) > 0 )
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   595
  {
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   596
    echo '<h3>' . $lang->get('acplm_heading_install') . '</h3>';
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   597
    echo '<div class="tblholder">
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   598
            <table border="0" cellspacing="1" cellpadding="4">
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   599
              <tr>
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   600
                <th>' . $lang->get('acplm_col_lang_code') . '</th>
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   601
                <th>' . $lang->get('acplm_col_lang_name') . '</th>
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   602
                <th>' . $lang->get('acplm_col_lang_name_eng') . '</th>
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   603
                <th></th>
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   604
              </tr>';
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   605
              
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   606
    $cls = 'row2';
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   607
    foreach ( $lang_list as $lang_code => $lang_data )
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   608
    {
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   609
      $cls = ( $cls == 'row1' ) ? 'row2' : 'row1';
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   610
      
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   611
      echo '<tr>';
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   612
      
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   613
      $lang_code = htmlspecialchars($lang_code);
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   614
      $lang_data['name'] = htmlspecialchars($lang_data['name']);
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   615
      $lang_data['name_eng'] = htmlspecialchars($lang_data['name_eng']);
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   616
      
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   617
      echo "<td class=\"$cls\" style=\"text-align: center;\">$lang_code</td>";
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   618
      echo "<td class=\"$cls\" style=\"text-align: center;\">{$lang_data['name']}</td>";
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   619
      echo "<td class=\"$cls\" style=\"text-align: center;\">{$lang_data['name_eng']}</td>";
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   620
      echo "<td class=\"$cls\" style=\"text-align: center;\"><button name=\"action\" value=\"install_language;iso639=$lang_code\">" . $lang->get('acplm_btn_install_language') . "</button></td>";
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   621
      
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   622
      echo '</tr>';
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   623
    }
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   624
    echo '    </tr>
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   625
            </table>
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   626
          </div>';
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   627
  }
376
66732bd4532c Finished (or nearly finished) the admin language CP
Dan
parents: 372
diff changeset
   628
  echo '</form>';
372
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   629
}
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff changeset
   630