<?php
//Check if called by script
if(THT != 1){die();}
class page {
public $navtitle;
public $navlist = array();
public function __construct() {
$this->navtitle = "Language Sub Menu";
$this->navlist[] = array("Change Language", "world.png", "changel");
$this->navlist[] = array("Edit Language", "lock.png", "editl");
$this->navlist[] = array("New Language", "user_red.png", "newl");
}
public function description() {
return "<strong>Language Settings</strong><br />
Here you can change your THT language. You can edit a language or create a new one...<br />
To get started, choose a link from the sidebar's SubMenu.";
}
public function content() {
global $main;
global $style;
global $db;
if($_POST) {
foreach($main->postvar as $key => $value) {
if($value == "" && !$n) { //if something is empty, do this
$main->errors("Please fill in all the fields!");
$n++;
}
} //stop foreach
if(!$n) { //if everything is ok, do this
foreach($main->postvar as $key => $value) {
$db->updateConfig($key, $value);
}
$main->errors("Language Updated!");
$main->done();
}
}
switch($main->getvar['sub']) { //look if something is clicked in the SubMenu
default:
$array['NAME'] = $db->config("name");
$array['URL'] = $db->config("url");
$values[] = array("Admin Area", "admin");
$values[] = array("Order Form", "order");
$values[] = array("Client Area", "client");
$array['DROPDOWN'] = $main->dropDown("default", $values, $db->config("default"));
echo $style->replaceVar("tpl/pathsettings.tpl", $array);
break;
case "changel": #change your language
$folder = '../includes/language';
if ($handle = opendir($folder)) { # Open the folder
while (false !== ($file = readdir($handle))) { # Read the files
if($file != "." && $file != ".." ) { # Check aren't these names
$values[] = array($file, $file);
}
}
}
closedir($handle); #Close the folder
$array['LANGUAGE'] = $main->dropDown("language", $values, $db->config("theme")); #set to LANGUAGE a dropbox with all the languages found in the /language folder
echo $style->replaceVar("tpl/languagesettings.tpl", $array); #replace %LANGUAGE% to a dropbox + output
break;