addACL( 'com_langinimaker', 'manage', 'users', 'super administrator' );
if (!$user->authorize( 'com_langinimaker', 'manage' )) {
$mainframe->redirect( 'index.php', JText::_('ALERTNOTAUTH') );
}
class list_dir {
var $x = 0;
var $files;
function scan_dir($dir) {
if(!$temp = @scandir($dir)) {
echo "".JText::_('Error! Files not found!')."
";
return;
}
for($i=0; $i < count($temp); $i++) {
if($temp[$i] != "." && $temp[$i] != "..") {
if(is_file("$dir/$temp[$i]"))
$this->files[] = "$dir/$temp[$i]";
elseif(is_dir("$dir/$temp[$i]"))
$stack[] = "$dir/$temp[$i]";
}
if((count($temp) - 1) == $i) {
if(isset($stack[$this->x])) {
$i = -1;
$dir = $stack[$this->x];
$temp = scandir($stack[$this->x]);
$this->x++;
}
}
}
}
}
function parseXmlGroup( &$xmlLinesParams, $params ) {
if (!empty($params)) {
$params = $params->children();
// get param
foreach($params as $param) {
$label = trim($param->attributes('label'));
if (!empty($label)) $xmlLinesParams[strtoupper($label)] = $label;
$descr = trim($param->attributes('description'));
if (!empty($descr)) $xmlLinesParams[strtoupper($descr)] = $descr;
// get param options
if ($param->children()) {
foreach($param->children() as $option) {
$data = trim($option->data());
if (!empty($data) && $option->name()=='option') $xmlLinesParams[strtoupper($data)] = $data;
}
}
}
}
}
//$language =& JFactory::getLanguage();
//$language->load( 'com_langinimaker' );
JToolBarHelper::title( JText::_( 'Language INI maker' ), 'generic.png' );
//JToolBarHelper::customX( 'update', 'unarchive.png', 'unarchive.png', 'Update' );
$task = JRequest::getCmd('task');
$db =& JFactory::getDBO();
$query = "
SELECT concat(name, ' (', `option`, ')') as `text`, `option` as value
FROM #__components
WHERE parent=0
group by `option`
order by `text`";
$db->setQuery( $query );
$arr_componets = $db->loadAssocList();
$options['languages'] = array();
$options['clients'] = array();
$options['clients']['S'] = JText::_('Site');
foreach (JLanguage::getKnownLanguages(JPATH_SITE) as $k=>$v) {
$options['languages']['S_'.$k] = $options['clients']['S'] . ' - '.$v['name'];
$all_langs[$k] = $v['name'];
}
$options['clients']['A'] = JText::_('Administrator');
foreach (JLanguage::getKnownLanguages(JPATH_ADMINISTRATOR) as $k=>$v) {
$options['languages']['A_'.$k] = $options['clients']['A'] . ' - '.$v['name'];
$all_langs[$k] = $v['name'];
}
foreach($all_langs as $k=>$v) {
$langs[] = array('value'=>$k, 'text'=>$v);
}
$clients = array(
array('value'=>'admin', 'text'=>JText::_('Administrator')),
array('value'=>'site', 'text'=>JText::_('Site'))
);
$comp = JRequest::getWord('component');
$sel_lang = JRequest::getVar('lang');
$client = JRequest::getCmd('client');
$excess = JRequest::getCmd('excess');
$checked = ($excess==1) ? 'checked' : '';
echo '