[ Index ]

PHP Cross Reference of MyBB

title

Body

[close]

/admin/modules/config/ -> languages.php (source)

   1  <?php
   2  /**
   3   * MyBB 1.6
   4   * Copyright 2010 MyBB Group, All Rights Reserved
   5   *
   6   * Website: http://mybb.com
   7   * License: http://mybb.com/about/license
   8   *
   9   * $Id$
  10   */
  11  
  12  // Disallow direct access to this file for security reasons
  13  if(!defined("IN_MYBB"))
  14  {
  15      die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
  16  }
  17  
  18  $languages = $lang->get_languages();
  19  
  20  $page->add_breadcrumb_item($lang->languages, "index.php?module=config-languages");
  21  
  22  $plugins->run_hooks("admin_config_languages_begin");
  23  
  24  if($mybb->input['action'] == "edit_properties")
  25  {
  26      $plugins->run_hooks("admin_config_languages_edit_properties");
  27      
  28      $editlang = basename($mybb->input['lang']);
  29      $file = MYBB_ROOT."inc/languages/".$editlang.".php";
  30      if(!file_exists($file))
  31      {
  32          flash_message($lang->error_invalid_file, 'error');
  33          admin_redirect("index.php?module=config-languages");
  34      }
  35      
  36      if($mybb->request_method == "post")
  37      {
  38          if(!is_writable($file))
  39          {
  40              flash_message($lang->error_cannot_write_to_file, 'error');
  41              admin_redirect("index.php?module=config-languages");
  42          }
  43          
  44          foreach($mybb->input['info'] as $key => $info)
  45          {
  46              $info = str_replace("\\", "\\\\", $info);
  47              $info = str_replace('$', '\$', $info);
  48              $newlanginfo[$key] = str_replace("\"", '\"', $info);
  49          }
  50          
  51          // Get contents of existing file
  52          require $file;
  53      
  54          // Make the contents of the new file
  55          $newfile = "<?php
  56  // The friendly name of the language
  57  \$langinfo['name'] = \"{$newlanginfo['name']}\";
  58  
  59  // The author of the language
  60  \$langinfo['author'] = \"{$langinfo['author']}\";
  61  
  62  // The language authors website
  63  \$langinfo['website'] = \"{$langinfo['website']}\";
  64  
  65  // Compatible version of MyBB
  66  \$langinfo['version'] = \"{$langinfo['version']}\";
  67  
  68  // Sets if the translation includes the Admin CP (1 = yes, 0 = no)
  69  \$langinfo['admin'] = {$newlanginfo['admin']};
  70  
  71  // Sets if the language is RTL (Right to Left) (1 = yes, 0 = no)
  72  \$langinfo['rtl'] = {$newlanginfo['rtl']};
  73  
  74  // Sets the lang in the <html> on all pages
  75  \$langinfo['htmllang'] = \"{$newlanginfo['htmllang']}\";
  76  
  77  // Sets the character set, blank uses the default.
  78  \$langinfo['charset'] = \"{$newlanginfo['charset']}\";\n".
  79  "?".">";
  80      
  81          // Put it in!
  82          if($file = fopen($file, "w"))
  83          {
  84              fwrite($file, $newfile);
  85              fclose($file);
  86  
  87              $plugins->run_hooks("admin_config_languages_edit_properties_commit");
  88  
  89              // Log admin action
  90              log_admin_action($editlang);
  91  
  92              flash_message($lang->success_langprops_updated, 'success');
  93              admin_redirect("index.php?module=config-languages&action=edit&lang={$editlang}&editwith={$editwith}");
  94          }
  95          else
  96          {
  97              $errors[] = $lang->error_cannot_write_to_file;
  98          }
  99      }
 100      
 101      $page->add_breadcrumb_item($languages[$editlang], "index.php?module=config-languages&amp;action=edit&amp;lang={$editlang}");
 102      $page->add_breadcrumb_item($lang->nav_editing_set);
 103      
 104      $page->output_header($lang->languages);
 105      
 106      $sub_tabs['edit_properties'] = array(
 107          "title" => $lang->edit_properties,
 108          "link" => "index.php?module=config-languages",
 109          "description" => $lang->edit_properties_desc
 110      );
 111      $page->output_nav_tabs($sub_tabs, "edit_properties");
 112  
 113      // Get language info
 114      require $file;
 115  
 116      $form = new Form("index.php?module=config-languages&amp;action=edit_properties", "post", "editset");
 117      echo $form->generate_hidden_field("lang", $editlang);
 118      echo $form->generate_hidden_field("info[author]", $langinfo['author']);
 119      echo $form->generate_hidden_field("info[website]", $langinfo['website']);
 120      echo $form->generate_hidden_field("info[version]", $langinfo['version']);
 121      
 122      if($errors)
 123      {
 124          $page->output_inline_error($errors);
 125      }
 126      else
 127      {
 128          if($langinfo['admin'])
 129          {
 130              $mybb->input['info']['admin'] = 1;
 131          }
 132          else
 133          {
 134              $mybb->input['info']['admin'] = 0;
 135          }
 136          
 137          if($langinfo['rtl'])
 138          {
 139              $mybb->input['info']['rtl'] = 1;
 140          }
 141          else
 142          {
 143              $mybb->input['info']['rtl'] = 0;
 144          }
 145          
 146          $mybb->input['info']['name'] = $langinfo['name'];
 147          $mybb->input['info']['htmllang'] = $langinfo['htmllang'];
 148          $mybb->input['info']['charset'] = $langinfo['charset'];
 149      }
 150  
 151      $form_container = new FormContainer($lang->edit_properties);
 152      
 153      $form_container->output_row($lang->friendly_name." <em>*</em>", "", $form->generate_text_box('info[name]', $mybb->input['info']['name'], array('id' => 'name')), 'name');
 154      $form_container->output_row($lang->language_in_html." <em>*</em>", "", $form->generate_text_box('info[htmllang]', $mybb->input['info']['htmllang'], array('id' => 'htmllang')), 'htmllang');
 155      $form_container->output_row($lang->charset." <em>*</em>", "", $form->generate_text_box('info[charset]', $mybb->input['info']['charset'], array('id' => 'charset')), 'charset');
 156      $form_container->output_row($lang->rtl." <em>*</em>", "", $form->generate_yes_no_radio('info[rtl]', $mybb->input['info']['rtl'], array('id' => 'rtl')), 'rtl');
 157      $form_container->output_row($lang->admin." <em>*</em>", "", $form->generate_yes_no_radio('info[admin]', $mybb->input['info']['admin'], array('id' => 'admin')), 'admin');
 158  
 159      // Check if file is writable, before allowing submission
 160      if(!is_writable($file))
 161      {
 162          $no_write = 1;
 163          $page->output_alert($lang->alert_note_cannot_write);
 164      }
 165  
 166      $form_container->end();
 167          
 168      $buttons[] = $form->generate_submit_button($lang->save_language_file, array('disabled' => $no_write));
 169  
 170      $form->output_submit_wrapper($buttons);
 171      $form->end();
 172      
 173      $page->output_footer();
 174  }
 175  
 176  if($mybb->input['action'] == "quick_phrases")
 177  {
 178      $plugins->run_hooks("admin_config_languages_quick_phrases");
 179      
 180      // Validate input
 181      $editlang = basename($mybb->input['lang']);
 182      $folder = MYBB_ROOT."inc/languages/".$editlang."/";
 183      
 184      $page->add_breadcrumb_item($languages[$editlang], "index.php?module=config-languages&amp;action=quick_edit&amp;lang={$editlang}");
 185      
 186      if(!file_exists($folder) || ($editwithfolder && !file_exists($editwithfolder)))
 187      {
 188          flash_message($lang->error_invalid_set, 'error');
 189          admin_redirect("index.php?module=config-languages");
 190      }
 191      
 192      $quick_phrases = array(
 193          'member.lang.php' => array(
 194              'agreement' => $lang->quickphrases_agreement,
 195              'agreement_1' => $lang->quickphrases_agreement_1,
 196              'agreement_2' => $lang->quickphrases_agreement_2,
 197              'agreement_3' => $lang->quickphrases_agreement_3,
 198              'agreement_4' => $lang->quickphrases_agreement_4,
 199              'agreement_5' => $lang->quickphrases_agreement_5
 200          ),
 201          'messages.lang.php' => array(
 202              'error_nopermission_guest_1' => $lang->quickphrases_error_nopermission_guest_1,
 203              'error_nopermission_guest_2' => $lang->quickphrases_error_nopermission_guest_2,
 204              'error_nopermission_guest_3' => $lang->quickphrases_error_nopermission_guest_3,
 205              'error_nopermission_guest_4' => $lang->quickphrases_error_nopermission_guest_4
 206          )
 207      );
 208      
 209      if($mybb->request_method == 'post')
 210      {
 211          if($mybb->request_method == 'post')
 212          {
 213              foreach($quick_phrases as $file => $phrases)
 214              {
 215                  $lines = file($folder.$file);
 216                  
 217                  $fp = fopen($folder.$file, 'w');
 218                  fwrite($fp, '<?php'.PHP_EOL);
 219                  
 220                  for($i = 1; $i < count($lines); $i++)
 221                  {
 222                      preg_match_all('/\$l\[\'([a-z].+)\'\]/', $lines[$i], $matches);
 223                      $phrase = $matches[1][0];
 224                      
 225                      if($mybb->input['edit'][$phrase])
 226                      {
 227                          $new_line = '$l[\''.$phrase.'\'] = "'.str_replace('"', '\"', $mybb->input['edit'][$phrase]).'";'.PHP_EOL;
 228                          fwrite($fp, $new_line);
 229                      }
 230                      else
 231                      {
 232                          fwrite($fp, $lines[$i]);
 233                      }
 234                  }
 235                  
 236                  fclose($fp);
 237              }
 238              
 239              // Log admin action
 240              log_admin_action($editlang);
 241              
 242              flash_message($lang->success_quickphrases_updated, 'success');
 243              admin_redirect('index.php?module=config-languages&amp;action=edit&amp;lang='.$editlang);
 244          }
 245      }
 246      
 247      $page->output_header($lang->languages);
 248      
 249      $sub_tabs['language_files'] = array(
 250          'title' => $lang->language_files,
 251          'link' => "index.php?module=config-languages&amp;action=edit&amp;lang=".$editlang,
 252          'description' => $lang->language_files_desc
 253      );
 254      
 255      $sub_tabs['quick_phrases'] = array(
 256          'title' => $lang->quick_phrases,
 257          'link' => "index.php?module=config-languages&amp;action=quick_phrases&amp;lang=".$editlang,
 258          'description' => $lang->quick_phrases_desc
 259      );
 260      
 261      $page->output_nav_tabs($sub_tabs, 'quick_phrases');
 262      
 263      $form = new Form('index.php?module=config-languages&amp;action=quick_phrases&amp;lang='.$editlang, 'post', 'quick_phrases');
 264      
 265      if($errors)
 266      {
 267          $page->output_inline_error($errors);
 268      }
 269      
 270      $table = new Table;
 271      
 272      // Check if file is writable, before allowing submission
 273      $no_write = null;
 274      
 275      foreach($quick_phrases as $file => $phrases)
 276      {
 277          if(!is_writable($folder.$file))
 278          {
 279              $no_write = 1;
 280          }
 281      }
 282      
 283      if($no_write)
 284      {
 285          $page->output_alert($lang->alert_note_cannot_write);
 286      }
 287      
 288      $form_container = new FormContainer($lang->quick_phrases);
 289      
 290      foreach($quick_phrases as $file => $phrases)
 291      {
 292          require $folder.$file;
 293          
 294          foreach($phrases as $phrase => $description)
 295          {
 296              $value = $l[$phrase];
 297              if(my_strtolower($langinfo['charset']) == "utf-8")
 298              {
 299                  $value = preg_replace_callback("#%u([0-9A-F]{1,4})#i", create_function('$matches', 'return dec_to_utf8(hexdec($matches[1]));'), $value);
 300              }
 301              else
 302              {
 303                  $value = preg_replace_callback("#%u([0-9A-F]{1,4})#i", create_function('$matches', 'return "&#".hexdec($matches[1]).";";'), $value);
 304              }
 305              
 306              $form_container->output_row($description, $phrase, $form->generate_text_area("edit[$phrase]", $value, array('id' => 'lang_'.$phrase, 'rows' => 2, 'style' => "width: 98%; padding: 4px;")), 'lang_'.$phrase, array('width' => '50%'));
 307          }
 308      }
 309      
 310      $form_container->end();
 311      
 312      $buttons[] = $form->generate_submit_button($lang->save_language_file, array('disabled' => $no_write));
 313  
 314      $form->output_submit_wrapper($buttons);
 315      $form->end();
 316      
 317      $page->output_footer();
 318  }
 319  
 320  if($mybb->input['action'] == "edit")
 321  {
 322      $plugins->run_hooks("admin_config_languages_edit");
 323      
 324      // Validate input
 325      $editlang = basename($mybb->input['lang']);
 326      $folder = MYBB_ROOT."inc/languages/".$editlang."/";
 327      
 328      $page->add_breadcrumb_item($languages[$editlang], "index.php?module=config-languages&amp;action=edit&amp;lang={$editlang}");
 329      
 330      $editwith = basename($mybb->input['editwith']);
 331      $editwithfolder = '';
 332      
 333      if($editwith)
 334      {
 335          $editwithfolder = MYBB_ROOT."inc/languages/".$editwith."/";
 336      }
 337      
 338      if(!file_exists($folder) || ($editwithfolder && !file_exists($editwithfolder)))
 339      {
 340          flash_message($lang->error_invalid_set, 'error');
 341          admin_redirect("index.php?module=config-languages");
 342      }
 343      
 344      if(isset($mybb->input['file']))
 345      {
 346          // Validate input
 347          $file = basename($mybb->input['file']);
 348          if($mybb->input['inadmin'] == 1)
 349          {
 350              $file = 'admin/'.$file;
 351          }
 352          $page->add_breadcrumb_item($file);
 353          
 354          $editfile = $folder.$file;
 355          $withfile = '';
 356          
 357          $editwithfile = '';
 358          if($editwithfolder)
 359          {
 360              $editwithfile = $editwithfolder.$file;
 361          }
 362  
 363          if(!file_exists($editfile) || ($editwithfile && !file_exists($editwithfile)) || $file == '.' || $file == '..')
 364          {
 365              flash_message($lang->error_invalid_file, 'error');
 366              admin_redirect("index.php?module=config-languages");
 367          }
 368          
 369          if($mybb->request_method == "post")
 370          {
 371              // Make the contents of the new file
 372              
 373              // Load the old file
 374              $contents = implode('', file($editfile));
 375              
 376              // Loop through and change entries
 377              foreach($mybb->input['edit'] as $key => $phrase)
 378              {
 379                  // Sanitize (but it doesn't work well)
 380                  $phrase = str_replace('$', '\$', $phrase);
 381                  $phrase = str_replace("\\", "\\\\", $phrase);
 382                  $phrase = str_replace("\"", '\"', $phrase);
 383                  $key = str_replace("\\", '', $key);
 384                  $key = str_replace('$', '', $key);
 385                  $key = str_replace("'", '', $key);
 386                  
 387                  // Ugly regexp to find a variable and replace it.
 388                  $contents = preg_replace('@\n\$l\[\''.$key.'\']([\s]*)=([\s]*)("(.*?)"|\'(.*?)\');([\s]*)\n@si', "\n\$l['{$key}'] = \"{$phrase}\";\n", $contents);
 389              }
 390              
 391              // Put it back!
 392              if($fp = @fopen($editfile, "w"))
 393              {
 394                  fwrite($fp, $contents);
 395                  fclose($fp);
 396                  
 397                  $plugins->run_hooks("admin_config_languages_edit_commit");
 398  
 399                  // Log admin action
 400                  log_admin_action($editlang, $editfile, $mybb->input['inadmin']);
 401  
 402                  flash_message($lang->success_langfile_updated, 'success');
 403                  admin_redirect("index.php?module=config-languages&action=edit&lang={$editlang}&editwith={$editwith}");
 404              }
 405              else
 406              {
 407                  $errors[] = $lang->error_cannot_write_to_file;
 408              }
 409          }
 410          
 411          // Get file being edited in an array
 412          require $editfile;
 413          
 414          if(count($l) > 0)
 415          {
 416              $editvars = $l;
 417          }
 418          else
 419          {
 420              $editvars = array();
 421          }
 422          unset($l);
 423  
 424          $withvars = array();
 425          // Get edit with file in an array
 426          if($editwithfile)
 427          {
 428              require $editwithfile;
 429              $withvars = $l;
 430              unset($l);
 431          }
 432  
 433          // Start output
 434          $page->output_header($lang->languages);
 435          
 436          $sub_tabs['edit_language_variables'] = array(
 437              "title" => $lang->edit_language_variables,
 438              "link" => "index.php?module=config-languages",
 439              "description" => $lang->edit_language_variables_desc
 440          );
 441          $page->output_nav_tabs($sub_tabs, "edit_language_variables");
 442          
 443          $form = new Form("index.php?module=config-languages&amp;action=edit", "post", "edit");
 444          echo $form->generate_hidden_field("file", $file);
 445          echo $form->generate_hidden_field("lang", $editlang);
 446          echo $form->generate_hidden_field("editwith", $editwith);
 447          echo $form->generate_hidden_field("inadmin", intval($mybb->input['inadmin']));
 448          if($errors)
 449          {
 450              $page->output_inline_error($errors);
 451          }
 452  
 453          // Check if file is writable, before allowing submission
 454          $no_write = null;
 455          if(!is_writable($editfile))
 456          {
 457              $no_write = 1;
 458              $page->output_alert($lang->alert_note_cannot_write);
 459          }
 460  
 461          $form_container = new FormContainer($file);
 462          if($editwithfile)
 463          {
 464              // Editing with another file
 465              $form_container->output_row_header($languages[$editwith]);
 466              $form_container->output_row_header($languages[$editlang]);
 467  
 468              // Make each editing row
 469              foreach($editvars as $key => $value)
 470              {
 471                  if(my_strtolower($langinfo['charset']) == "utf-8")
 472                  {
 473                      $withvars[$key] = preg_replace_callback("#%u([0-9A-F]{1,4})#i", create_function('$matches', 'return dec_to_utf8(hexdec($matches[1]));'), $withvars[$key]);
 474                      $value = preg_replace_callback("#%u([0-9A-F]{1,4})#i", create_function('$matches', 'return dec_to_utf8(hexdec($matches[1]));'), $value);
 475                  }
 476                  else
 477                  {
 478                      $withvars[$key] = preg_replace_callback("#%u([0-9A-F]{1,4})#i", create_function('$matches', 'return dec_to_utf8(hexdec($matches[1]));'), $withvars[$key]);
 479                      $value = preg_replace_callback("#%u([0-9A-F]{1,4})#i", create_function('$matches', 'return "&#".hexdec($matches[1]).";";'), $value);
 480                  }
 481                  $form_container->output_row($key, "", $form->generate_text_area("", $withvars[$key], array('disabled' => true, 'rows' => 2, 'style' => "width: 98%; padding: 4px;")), "", array('width' => '50%', 'skip_construct' => true));
 482                  $form_container->output_row($key, "", $form->generate_text_area("edit[$key]", $value, array('id' => 'lang_'.$key, 'rows' => 2, 'style' => "width: 98%; padding: 4px;")), 'lang_'.$key, array('width' => '50%'));
 483              }
 484          }
 485          else
 486          {
 487              // Editing individually
 488              $form_container->output_row_header($languages[$editlang]);
 489      
 490              // Make each editing row
 491              foreach($editvars as $key => $value)
 492              {
 493                  if(my_strtolower($langinfo['charset']) == "utf-8")
 494                  {
 495                      $value = preg_replace_callback("#%u([0-9A-F]{1,4})#i", create_function('$matches', 'return dec_to_utf8(hexdec($matches[1]));'), $value);
 496                  }
 497                  else
 498                  {
 499                      $value = preg_replace_callback("#%u([0-9A-F]{1,4})#i", create_function('$matches', 'return "&#".hexdec($matches[1]).";";'), $value);
 500                  }
 501                  $form_container->output_row($key, "", $form->generate_text_area("edit[$key]", $value, array('id' => 'lang_'.$key, 'rows' => 2, 'style' => "width: 98%; padding: 4px;")), 'lang_'.$key, array('width' => '50%'));
 502              }
 503          }
 504          $form_container->end();
 505          
 506          $buttons[] = $form->generate_submit_button($lang->save_language_file, array('disabled' => $no_write));
 507  
 508          $form->output_submit_wrapper($buttons);
 509          $form->end();
 510      }
 511      else
 512      {
 513          $page->output_header($lang->languages);
 514          
 515          $sub_tabs['language_files'] = array(
 516              'title' => $lang->language_files,
 517              'link' => "index.php?module=config-languages&amp;action=edit&amp;lang=".$editlang,
 518              'description' => $lang->language_files_desc
 519          );
 520          
 521          $sub_tabs['quick_phrases'] = array(
 522              'title' => $lang->quick_phrases,
 523              'link' => "index.php?module=config-languages&amp;action=quick_phrases&amp;lang=".$editlang,
 524              'description' => $lang->quick_phrases_desc
 525          );
 526          
 527          $page->output_nav_tabs($sub_tabs, 'language_files');
 528          
 529          require MYBB_ROOT."inc/languages/".$editlang.".php";
 530          
 531          $table = new Table;
 532          $table->construct_header($lang->file);
 533          $table->construct_header($lang->controls, array("class" => "align_center", "width" => 100));
 534          
 535          // Get files in main folder
 536          $filenames = array();
 537          if($handle = opendir($folder))
 538          {
 539              while(false !== ($file = readdir($handle)))
 540              {
 541                  if(preg_match("#\.lang\.php$#", $file))
 542                  {
 543                      $filenames[] = $file;
 544                  }
 545              }
 546              closedir($handle);
 547              sort($filenames);            
 548          }
 549          
 550          foreach($filenames as $key => $file)
 551          {
 552              $table->construct_cell("<strong>{$file}</strong>");
 553              $table->construct_cell("<a href=\"index.php?module=config-languages&amp;action=edit&amp;lang={$editlang}&amp;editwith={$editwith}&amp;file={$file}\">{$lang->edit}</a>", array("class" => "align_center"));
 554              $table->construct_row();
 555          }
 556          
 557          if($table->num_rows() == 0)
 558          {
 559              $table->construct_cell($lang->no_language_files_front_end, array('colspan' => 3));
 560              $table->construct_row();
 561          }
 562          
 563          $table->output($lang->front_end);
 564          
 565          if($langinfo['admin'] != 0)
 566          {        
 567              // Get files in admin folder
 568              $adminfilenames = array();
 569              if($handle = opendir($folder."admin"))
 570              {
 571                  while(false !== ($file = readdir($handle)))
 572                  {
 573                      if(preg_match("#\.lang\.php$#", $file))
 574                      {
 575                          $adminfilenames[] = $file;
 576                      }
 577                  }
 578                  closedir($handle);
 579                  sort($adminfilenames);
 580              }
 581              
 582              $table = new Table;
 583              $table->construct_header($lang->file);
 584              $table->construct_header($lang->controls, array("class" => "align_center", "width" => 100));
 585              
 586              foreach($adminfilenames as $key => $file)
 587              {
 588                  $table->construct_cell("<strong>{$file}</strong>");
 589                  $table->construct_cell("<a href=\"index.php?module=config-languages&amp;action=edit&amp;lang={$editlang}&amp;editwith={$editwith}&amp;file={$config['admindir']}/{$file}&amp;inadmin=1\">{$lang->edit}</a>", array("class" => "align_center"));
 590                  $table->construct_row();
 591              }
 592              
 593              if($table->num_rows()  == 0)
 594              {
 595                  $table->construct_cell($lang->no_language_files_admin_cp, array('colspan' => 3));
 596                  $table->construct_row();
 597              }
 598              
 599              $table->output($lang->admin_cp);
 600          }
 601      }
 602      
 603      $page->output_footer();
 604  }
 605  
 606  
 607  if(!$mybb->input['action'])
 608  {
 609      $plugins->run_hooks("admin_config_languages_start");
 610      
 611      $page->output_header($lang->languages);
 612  
 613      $sub_tabs['languages'] = array(
 614          'title' => $lang->languages,
 615          'link' => "index.php?module=config-languages",
 616          'description' => $lang->languages_desc
 617      );
 618      $sub_tabs['find_language'] = array(
 619          'title' => $lang->find_language_packs,
 620          'link' => "http://mybb.com/downloads/translations",
 621          'target' => "_blank"
 622      );
 623  
 624      $page->output_nav_tabs($sub_tabs, 'languages');
 625      
 626      $table = new Table;
 627      $table->construct_header($lang->languagevar);
 628      $table->construct_header($lang->version, array("class" => "align_center", "width" => 100));
 629      $table->construct_header($lang->controls, array("class" => "align_center", "width" => 155));
 630      
 631      asort($languages);
 632      
 633      foreach($languages as $key1 => $langname1)
 634      {
 635          $langselectlangs[$key1] = $lang->sprintf($lang->edit_with, $langname1);
 636      }
 637      
 638      foreach($languages as $key => $langname)
 639      {
 640          include MYBB_ROOT."inc/languages/".$key.".php";
 641          
 642          if(!empty($langinfo['website']))
 643          {
 644              $author = "<a href=\"{$langinfo['website']}\" target=\"_blank\">{$langinfo['author']}</a>";
 645          }
 646          else
 647          {
 648              $author = $langinfo['author'];
 649          }
 650          
 651          $table->construct_cell("<strong>{$langinfo['name']}</strong><br /><small>{$author}</small>");
 652          $table->construct_cell($langinfo['version'], array("class" => "align_center"));
 653          
 654          $popup = new PopupMenu("laguage_{$key}", $lang->options);
 655          $popup->add_item($lang->edit_language_variables, "index.php?module=config-languages&amp;action=edit&amp;lang={$key}");
 656          foreach($langselectlangs as $key1 => $langname1)
 657          {
 658              $popup->add_item($langname1, "index.php?module=config-languages&amp;action=edit&amp;lang={$key}&amp;editwith={$key1}");
 659           }
 660          $popup->add_item($lang->edit_properties, "index.php?module=config-languages&amp;action=edit_properties&amp;lang={$key}");
 661          $table->construct_cell($popup->fetch(), array("class" => "align_center"));
 662          $table->construct_row();
 663      }
 664      
 665      if($table->num_rows()  == 0)
 666      {
 667          $table->construct_cell($lang->no_language, array('colspan' => 3));
 668          $table->construct_row();
 669      }
 670      
 671      $table->output($lang->installed_language_packs);
 672      
 673      $page->output_footer();
 674  }
 675  
 676  ?>


Generated: Tue Oct 8 19:19:50 2013 Cross-referenced by PHPXref 0.7.1