This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Translation
#11
RE: Translation
Hi Sentora users

Here i put the ZXTS's controlled updated to sentora core

PHP Code:
<?php

/**
 *
 * ZPanel - A Cross-Platform Open-Source Web Hosting Control panel.
 *
 * @package ZPanel
 * @version $Id$
 * @author Bobby Allen - ballen@zpanelcp.com
 * @copyright (c) 2008-2011 ZPanel Group - http://www.zpanelcp.com/
 * @license http://opensource.org/licenses/gpl-3.0.html GNU Public License v3
 *
 * This program (ZPanel) is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

 /*
 The below module was made by Sam Mottley and it to be used for ZPanelX and ZPanelX ONLY!!!
 ZPanel Forum Username: Motters
 Website: SamMottley.co.uk
 Email SMottley@ZPanelCP.com or Info@SamMottley.co.uk
 */
class module_controller {
     
 static $ok;
     
 static $message;
     
 static $messageType;
    
/*
    * Here we set the ZXTS api address
    * @Author Sam Mottley
    */
    
static function getZxtsApi(){
        
$apiAddress 'http://sammottley.co.uk/ZPanel/ZXTS/ZXTSExport.php?';
        return 
$apiAddress;
    }

    
/*
    * Here we will retrive the data and format it into an array
    * @Author Sam Mottley
    *
    */
    
static function dataRetrieval($Type,$search=NULL){

        
runtime_hook::Execute('OnBeforeGetZXTSLanuages');
        try{
            
$zxtsApi = new xml_reader(fs_filehandler::ReadFileContents(self::getZxtsApi().$Type.$search));
 
           $zxtsApi->Parse();
 
           $responce $zxtsApi->document->responce[0]->tagData;

            switch(
$responce){
                case 
1//successfull
                    
if($Type == 'listLanuages'){
                        
$totalLanuages $zxtsApi->document->total[0]->tagData 1;

                        if(
$totalLanuages != -1){
                            
runtime_hook::Execute('OnBeforeGetZXTSLanuageList');
                            for(
$i=0$i<=$totalLanuages$i++){
                                
$n $i+1;

                                
$lanuages[$n]['name'] = $zxtsApi->document->lanuage[$i]->tagChildren[0]->tagData;
                                
$lanuages[$n]['percentage'] = $zxtsApi->document->lanuage[$i]->tagChildren[1]->tagData;
                            }
                            
$lanuages['status'] = 1;
                            
runtime_hook::Execute('OnAfterGetZXTSLanuageList');
                            return 
$lanuages;
                        }else{
                            
$lanuages['langaugeTable'] = ui_language::translate('Sorry there are no avalible lanuages at the moment');
                            
$lanuages['status'] = 1;
                            return 
$lanuages;
                        }
                    }else if(
$Type == 'Lanuage'){
                        
runtime_hook::Execute('OnBeforeGetZXTSLanuageInformation');
                        
$sqlCommands['addColumn'] = $zxtsApi->document->tagChildren[0]->tagData;
                        
$sqlCommands['addTranslation'] = $zxtsApi->document->tagChildren[1]->tagData;
                        
$sqlCommands['status'] = 1;
                        
runtime_hook::Execute('OnAfterGetZXTSLanuageInformation');
                        return 
$sqlCommands;
                    }
                    
runtime_hook::Execute('OnAfterGetZXTSLanuages');
                break;
                case 
0//Lanuage does not exsist
                    
$Error 0;
                    return 
$Error;
                break;
                case 
2//empty get varable
                    
$Error 2;
                    return 
$Error;
                break;
            }


         
   return $responce;
        } catch (
Exception $e) {
 
           return '3';
 
       }

    }

    
/*
    *Here we see what lanuages are install and how complete they are
    *
    */
    
static function languageInstalledPercentage($lanuage){
        global 
$zdbh;
        
$translations ui_language::GetColumnNames('x_translations');
        
$Present 0;
        
$Total 0;
        
$result '';

        
runtime_hook::Execute('OnBeforeGetInstallLanuages');
        foreach (
$translations as $translationInfo) {
            
$u $translationInfo;
 
           if (($translationInfo != 'tr_id_pk')&&($translationInfo != 'tr_en_pk')) {


                if(
$translationInfo == $lanuage){
                    
$translation $zdbh->prepare("SELECT * FROM `x_translations`");
                 
   $translation->execute();

                    
$arrayTranslation $translation->fetchAll();
                    foreach(
$arrayTranslation as $number => $translationLine){
                        if((
$translationLine[$lanuage] != '')&&($translationLine[$lanuage] != NULL)){
                            
$Present++;
                            
$Total++;
                        }else{
                            
$Total++;
                        }
                    }

                    
$numberTranslations $Present;
                    
$percentage $Present $Total 100;
                    
$roundPercentage round($percentage2);
                    
$result $roundPercentage;
                }
            }

        }
        
runtime_hook::Execute('OnAfterGetInstallLanuages');
        if(
$result == ''){
            
$result 'NO';
        }
        return 
$result;

    }

    
/*
    *Capture the appy symbolic support post
    */
    
static function doApplySymbolicSupport(){
        global 
$zdbh;
 
       global $controller;

        
//$formVarables = $controller->GetAllControllerRequests('FORM');

         
if (self::ExecuteApplySymbolicSupport()){
            return 
true;
         }else{
 
           return false;
         }

    }
    
/*
    *Capture the remove symbolic support post
    */
    
static function doRemoveSymbolicSupport(){
        global 
$zdbh;
 
       global $controller;

        
//$formVarables = $controller->GetAllControllerRequests('FORM');

        
if (self::ExecuteRemoveSymbolicSupport()){
            return 
true;
        }else{
 
           return false;
        }
    }

    
/*
    *Capture the install language post
    */
    
static function doInstallLanuage(){
        global 
$zdbh;
 
       global $controller;

        
$formVarables $controller->GetAllControllerRequests('FORM');

        if (
self::ExecuteInstallLanuage($formVarables['inlanguage'])){
            return 
true;
        }else{
 
           return false;
        }
    }

    
/*
    *Capture the un-install language post
    */
    
static function doUnInstallLanuage(){
        global 
$zdbh;
 
       global $controller;

        
$formVarables $controller->GetAllControllerRequests('FORM');

        if (
self::ExecuteUnInstallLanuage($formVarables['inLanguage1'])){
            return 
true;
        }else{
 
           return false;
        }
    }


    static function 
ExecuteApplySymbolicSupport(){
        global 
$zdbh;
 
       global $controller;
        
//latin1_swedish_ci


        
runtime_hook::Execute('OnBeforeAddSymbolicSupport');
        
//Below we add the Collation
        
$checkCollation "SHOW TABLE STATUS FROM `sentora_core` LIKE 'x_translations'";
        
$checkCollation $zdbh->prepare($checkCollation);
        
$checkCollation->execute();
        
$tableInformation $checkCollation->fetchAll();


        if(
$tableInformation[0]['Collation'] == 'utf8_general_ci'){
            
//Table collation is using UTF so we are ok
            
$ErrorReport['table'] = '<img src="modules/' $controller->GetControllerRequest('URL''module') . '/assets/up.gif" border="0">'.ui_language::translate('Database tables character and collate were already using UTF8');
        }else{

            
$changeCollation "ALTER TABLE `x_translations` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();


            
$changeCollation "ALTER TABLE `x_accounts` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_aliases` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_bandwidth` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_cronjobs` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_distlists` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_distlistusers` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_dns` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_faqs` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_forwarders` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_ftpaccounts` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_groups` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_htaccess` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_logs` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_mailboxes` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_modcats` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_modules` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_mysql` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_mysql_databases` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_mysql_dbmap` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_mysql_users` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_packages` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_permissions` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_profiles` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_quotas` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_settings` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_vhosts` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$ErrorReport['table'] = '<img src="modules/' $controller->GetControllerRequest('URL''module') . '/assets/up.gif" border="0"> Database tables character and collate is now UTF8';
        }


        
//Below we add that the driver.class.php has the php additons
        
$driverDb  fs_filehandler::ReadFileContents('dryden/db/driver.class.php');

        if(
preg_match('/public function query\(\$query\)\s{\s*try\s{\s*\$FIXSql1 = "set character_set_server=\'utf8\'";\s*\$FIXSql2 = "set names \'utf8\'";\s*\$FIX = parent::query\(\$FIXSql1\);\s*\$FIX2 = parent::query\(\$FIXSql2\);/'$driverDb)){
            
//Do knowthing as the php addtions is already there
                
$test 1;
                
$ErrorReport['databaseDriver'] = '<img src="modules/' $controller->GetControllerRequest('URL''module') . '/assets/up.gif" border="0">Database driver already has the addition code that is needed';
        }else{
            
$newDriverDb preg_replace('/public function query\(\$query\)\s{\s*try\s{\s*/''public function query($query) { try { $FIXSql1 = "set character_set_server=\'utf8\'"; $FIXSql2 = "set names \'utf8\'"; $FIX = parent::query($FIXSql1); $FIX2 = parent::query($FIXSql2); '$driverDb);

            if(
fs_filehandler::UpdateFile('dryden/db/driver.class.php'0777$newDriverDb)){
                
$test 2;
                
$ErrorReport['databaseDriver'] = '<img src="modules/' $controller->GetControllerRequest('URL''module') . '/assets/up.gif" border="0">'.ui_language::translate('Database driver now has the addition code that is needed');
            }else{
                
$test 3;
                
$ErrorReport['databaseDriver'] = '<img src="modules/' $controller->GetControllerRequest('URL''module') . '/assets/down.gif" border="0">'.ui_language::translate('ERROR: Could not edit the file dryden/db/driver.class.php');
            }
        }



        
//Below we add that the template is utf8
        
$templateCode fs_filehandler::ReadFileContents('etc\styles\Sentora_Default\master.ztml');
        if(!
strstr($templateCode'<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />')){
            
$newTemplateCode str_replace('<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">''<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />'$templateCode);

            if(
fs_filehandler::UpdateFile('etc\styles\Sentora_Default\master.ztml'0777$newTemplateCode)){
                
$ErrorReport['templateTag'] = '<img src="modules/' $controller->GetControllerRequest('URL''module') . '/assets/up.gif" border="0">'.ui_language::translate('Template now supports UTF8');
            }else{
                
$ErrorReport['templateTag'] = '<img src="modules/' $controller->GetControllerRequest('URL''module') . '/assets/down.gif" border="0">'.ui_language::translate('ERROR: Could not edit the file etc\styles\Sentora_Default\master.ztml');
            }
        }else{
            
$ErrorReport['templateTag'] = '<img src="modules/' $controller->GetControllerRequest('URL''module') . '/assets/up.gif" border="0">'.ui_language::translate('Template already supports UTF8');
        }




        
//Make message
        
$report '';
        foreach(
$ErrorReport as $titleError => $descriptionError){
            
$report .= $descriptionError '<br/>';
        }

        
runtime_hook::Execute('OnAfterAddSymbolicSupport');
        
self::$ok 3;
        
self::$message $report;
        
self::$messageType 'zannounceok';
        return 
true;
    }

    static function 
ExecuteRemoveSymbolicSupport(){
        global 
$zdbh;
 
       global $controller;
        
//latin1_swedish_ci

        
runtime_hook::Execute('OnBeforeRemoveSymbolicSupport');
        
//Below we add the Collation
        
$checkCollation "SHOW TABLE STATUS FROM `sentora_core` LIKE 'x_translations'";
        
$checkCollation $zdbh->prepare($checkCollation);
        
$checkCollation->execute();
        
$tableInformation $checkCollation->fetchAll();



        if(
$tableInformation[0]['Collation'] == 'latin1_swedish_ci'){
            
//Table collation is using UTF so we are ok
            
$ErrorReport['table'] = '<img src="modules/' $controller->GetControllerRequest('URL''module') . '/assets/up.gif" border="0">'.ui_language::translate('Database tables character and collate were already at there default latin1_swedish_ci');
        }else{

            
$changeCollation "ALTER TABLE `x_translations` CONVERT TO CHARACTER SET latin1 COLLATE latin1_swedish_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();


            
$changeCollation "ALTER TABLE `x_accounts` CONVERT TO CHARACTER SET latin1 COLLATE latin1_swedish_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_aliases` CONVERT TO CHARACTER SET latin1 COLLATE latin1_swedish_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_bandwidth` CONVERT TO CHARACTER SET latin1 COLLATE latin1_swedish_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_cronjobs` CONVERT TO CHARACTER SET latin1 COLLATE latin1_swedish_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_distlists` CONVERT TO CHARACTER SET latin1 COLLATE latin1_swedish_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_distlistusers` CONVERT TO CHARACTER SET latin1 COLLATE latin1_swedish_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_dns` CONVERT TO CHARACTER SET latin1 COLLATE latin1_swedish_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_faqs` CONVERT TO CHARACTER SET latin1 COLLATE latin1_swedish_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_forwarders` CONVERT TO CHARACTER SET latin1 COLLATE latin1_swedish_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_ftpaccounts` CONVERT TO CHARACTER SET latin1 COLLATE latin1_swedish_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_groups` CONVERT TO CHARACTER SET latin1 COLLATE latin1_swedish_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_htaccess` CONVERT TO CHARACTER SET latin1 COLLATE latin1_swedish_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_logs` CONVERT TO CHARACTER SET latin1 COLLATE latin1_swedish_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_mailboxes` CONVERT TO CHARACTER SET latin1 COLLATE latin1_swedish_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_modcats` CONVERT TO CHARACTER SET latin1 COLLATE latin1_swedish_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_modules` CONVERT TO CHARACTER SET latin1 COLLATE latin1_swedish_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_mysql` CONVERT TO CHARACTER SET latin1 COLLATE latin1_swedish_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_mysql_databases` CONVERT TO CHARACTER SET latin1 COLLATE latin1_swedish_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_mysql_dbmap` CONVERT TO CHARACTER SET latin1 COLLATE latin1_swedish_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_mysql_users` CONVERT TO CHARACTER SET latin1 COLLATE latin1_swedish_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_packages` CONVERT TO CHARACTER SET latin1 COLLATE latin1_swedish_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_permissions` CONVERT TO CHARACTER SET latin1 COLLATE latin1_swedish_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_profiles` CONVERT TO CHARACTER SET latin1 COLLATE latin1_swedish_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_quotas` CONVERT TO CHARACTER SET latin1 COLLATE latin1_swedish_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_settings` CONVERT TO CHARACTER SET latin1 COLLATE latin1_swedish_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$changeCollation "ALTER TABLE `x_vhosts` CONVERT TO CHARACTER SET latin1 COLLATE latin1_swedish_ci;";
            
$changeCollation $zdbh->prepare($changeCollation);
            
$changeCollation->execute();

            
$ErrorReport['table'] = '<img src="modules/' $controller->GetControllerRequest('URL''module') . '/assets/up.gif" border="0">'.ui_language::translate('Database tables character and collate are now back to there default latin1_swedish_ci');

        }


        
//Change driver.class.php back to it's default
        
$driverDb  fs_filehandler::ReadFileContents('dryden/db/driver.class.php');

        if(
preg_match('/public function query\(\$query\)\s{\s*try\s{\s*\$FIXSql1 = "set character_set_server=\'utf8\'";\s*\$FIXSql2 = "set names \'utf8\'";\s*\$FIX = parent::query\(\$FIXSql1\);\s*\$FIX2 = parent::query\(\$FIXSql2\);/'$driverDb)){
            
//Remove the additional PHP
            
$newDriverDb preg_replace('/public function query\(\$query\)\s{\s*try\s{\s*\$FIXSql1 = "set character_set_server=\'utf8\'";\s*\$FIXSql2 = "set names \'utf8\'";\s*\$FIX = parent::query\(\$FIXSql1\);\s*\$FIX2 = parent::query\(\$FIXSql2\);/''public function query($query) { try { '$driverDb);

            if(
fs_filehandler::UpdateFile('dryden/db/driver.class.php'0777$newDriverDb)){
                
$ErrorReport['databaseDriver'] = '<img src="modules/' $controller->GetControllerRequest('URL''module') . '/assets/up.gif" border="0">'.ui_language::translate('Database driver now has the addition code removed');
            }else{
                
$ErrorReport['databaseDriver'] = '<img src="modules/' $controller->GetControllerRequest('URL''module') . '/assets/down.gif" border="0">'.ui_language::translate('ERROR: Could not edit the file dryden/db/driver.class.php');
            }

        }else{
            
//Code could not be found maybe it's already been removed
            
$ErrorReport['databaseDriver'] = '<img src="modules/' $controller->GetControllerRequest('URL''module') . '/assets/up.gif" border="0">'.ui_language::translate('Database driver addition code could not be found it may of already been removed');
        }



        
//Now we return the template back to
        
$templateCode fs_filehandler::ReadFileContents('etc\styles\Sentora_Default\master.ztml');
        if(
strstr($templateCode'<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />')){
            
$newTemplateCode str_replace('<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />''<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">'$templateCode);

            if(
fs_filehandler::UpdateFile('etc\styles\Sentora_Default\master.ztml'0777$newTemplateCode)){
                
$ErrorReport['templateTag'] = '<img src="modules/' $controller->GetControllerRequest('URL''module') . '/assets/up.gif" border="0">'.ui_language::translate('Template now returned to using the default charset of ISO-8859-1');
            }else{
                
$ErrorReport['templateTag'] = '<img src="modules/' $controller->GetControllerRequest('URL''module') . '/assets/down.gif" border="0">'.ui_language::translate('ERROR: Could not edit the file etc\styles\Sentora_Default\master.ztml');
            }
        }else{
            
$ErrorReport['templateTag'] = '<img src="modules/' $controller->GetControllerRequest('URL''module') . '/assets/up.gif" border="0">'.ui_language::translate('Template already using the default charset of ISO-8859-1');
        }



        
//Make message
        
$report '';
        foreach(
$ErrorReport as $titleError => $descriptionError){
            
$report .= $descriptionError '<br/>';
        }

        
runtime_hook::Execute('OnAfterRemoveSymbolicSupport');
        
self::$ok 4;
        
self::$message $report;
        
self::$messageType 'zannounceok';
        return 
true;
    }

    static function 
ExecuteInstallLanuage($language){
        global 
$zdbh;
 
       global $controller;

        
runtime_hook::Execute('OnBeforeInstallLanuage');
        
$languageInfo self::dataRetrieval('Lanuage''=tr_'.$language.'_tx');
        if(!empty(
$languageInfo)){
            if(
$languageInfo['status'] == 1){

                
$currentTranslations ui_language::GetColumnNames('x_translations');
                if(!
in_array('tr_'.$language.'_tx'$currentTranslations)){
                    
$AddColumn $languageInfo['addColumn'];
                    
$AddColumn $zdbh->prepare($AddColumn);
                    
$AddColumn->execute();
                }

                
$AddTranlation str_replace("NULLWHEN '""NULL WHEN '"str_replace("'WHEN '""' WHEN '",$languageInfo['addTranslation']));
                
$AddTranlation $zdbh->prepare($AddTranlation);
     
              $AddTranlation->execute();

                
self::$ok 1;
                
self::$message ui_language::translate('Translations was added successfully');
                
self::$messageType 'zannounceok';
                return 
true;
            }else{
                
self::$ok 1;
                
self::$message ui_language::translate('Could not find language');
                
self::$messageType 'zannounceerror';
                return 
false;
            }
        }else{
            
self::$ok 1;
            
self::$message ui_language::translate('Could not contact ZXTS');
            
self::$messageType 'zannounceerror';
            return 
false;
        }
        
runtime_hook::Execute('OnAfterInstallLanuage');
    }

    static function 
ExecuteUnInstallLanuage($language){
        global 
$zdbh;
 
       global $controller;
        
runtime_hook::Execute('OnBeforeUnInstallLanuage');
        
$currentTranslations ui_language::GetColumnNames('x_translations');
                if(
in_array('tr_'.$language.'_tx'$currentTranslations)){
                    
$languageDatabaseName 'tr_'.$language.'_tx';

                    
$removeLanuage "ALTER TABLE `x_translations` DROP `$languageDatabaseName`";
                    
$removeLanuage $zdbh->prepare($removeLanuage);
                    
$removeLanuage->execute();

                    
self::$ok 2;
                    
self::$message ui_language::translate('Lanuage remove successfully from ZPanelX');
                    
self::$messageType 'zannounceok';
                    return 
true;
                }else{
                    
self::$ok 2;
                    
self::$message ui_language::translate('Lanuage could not be found on your ZPanelX server maybe it has already been deleted');
                    
self::$messageType 'zannounceerror';
                    return 
false;
                }
        
runtime_hook::Execute('OnAfterUnInstallLanuage');

    }


    static function 
getResult() {
 
       if (!fs_director::CheckForEmptyValue(self::$ok)) {
            switch(
self::$ok){
                case 
1:
                    return 
ui_sysmessage::shout(self::$messageself::$messageType);
                break;
                case 
2:
                    return 
ui_sysmessage::shout(self::$messageself::$messageType);
                break;
                case 
3:
                    return 
ui_sysmessage::shout(self::$messageself::$messageType);
                break;
                case 
4:
                    return 
ui_sysmessage::shout(self::$messageself::$messageType);
                break;
            }
        }
 
       return//return nothing so it will show something durrr ;)
 
   }

    static function 
SymbolicLanguageSupportStatus(){
        global 
$zdbh;

        
//Below we check the Collation
        
$checkCollation "SHOW TABLE STATUS FROM `sentora_core` LIKE 'x_translations'";
        
$checkCollation $zdbh->prepare($checkCollation);
        
$checkCollation->execute();

        
$tableInformation $checkCollation->fetchAll();

        if(
$tableInformation[0]['Collation'] == 'utf8_general_ci'){
            
$check[] = 1;
        }else{
            
$check[] = 0;
        }

        
//Below we check that the driver.class.php has the php additons
        
$driverDb  fs_filehandler::ReadFileContents('dryden/db/driver.class.php');
        if(!
strstr($driverDb'$FIXSql1 = "set character_set_server=\'utf8\'";')){
            
$check[] = 0;
        }
        if(!
strstr($driverDb'$FIXSql2 = "set names \'utf8\'";')){
            
$check[] = 0;
        }
        if(!
strstr($driverDb'$FIX = parent::query($FIXSql1);')){
            
$check[] = 0;
        }
        if(!
strstr($driverDb'$FIX2 = parent::query($FIXSql2);')){
            
$check[] = 0;
        }

        
//Below we check that the template is utf8
        
$templateCode fs_filehandler::ReadFileContents('etc\styles\Sentora_Default\master.ztml');
        if(!
strstr($templateCode'<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />')){
            
$check[] = 0;
        }

        
//Make the deisition
        
if(in_array(0,$check)){
            return 
ui_language::translate('Symbolic Language Support is <strong>NOT</strong> currently applied');
        }else{
            return 
ui_language::translate('Symbolic Language Support is currently applied');
        }
    }

    static function 
getApplySymbolicLanguageFix(){
        
$Table '<h2>'.ui_language::translate('Apply Symbolic Language Support').'</h2>';
        
$Table .= '<h4>'.ui_language::translate('Explanation').'</h4>
                        <p>'
.ui_language::translate('In ZPanelX there are a few tasks that need to be undertook for ZPanelX to support symbolic lanuages. The below will handle all the task for you.').'</p>
                  <h4>'
.ui_language::translate('Have Problems?').'</h4>
                      <ul style="margin-left:20px;">
                        <li>'
.ui_language::translate('In an event that you update ZPanelX and the symbolic lanuages stop showing correctly just click Apply Symbolic Support button below and the languages should start to show properly again.').'</li>
                            <ul style="margin-left:40px; margin-bottom:10px;">
                                <li>'
.ui_language::translate('If the lanaguages still do not show up properly then clikc the install button on the lanuage again').'</li>
                            </ul>
                        <li>'
.ui_language::translate('If you have installed an symbolic lanuage before appling the patch please first apply the patch by click Apply Symbolic Support button and then click the install button on the lanuage again.').'</li>
                    </ul>
                    <br/><br/>
                    <table>
                        <tr height="30">
                            <th width="340">'
.ui_language::translate('Symbolic Language Support Applied?').'</th>
                            <td><h4><span style="color: #D63333;">'
.self::SymbolicLanguageSupportStatus().'</span></h4></td>
                        </tr>
                        <tr height="30">
                            <th>'
.ui_language::translate('Apply Symbolic Language Support: ').'</th>
                            <td><form action="./?module=ZXTS&action=ApplySymbolicSupport" method="post" id="a" name="a"><button class="fg-button ui-state-default ui-corner-all" id="button" type="submit" >'
.ui_language::translate('Apply Symbolic Support').'</button></form> </td>
                        </tr>
                        <tr height="30">
                            <th>'
.ui_language::translate('Remove Symbolic Language Support: ').'</th>
                            <td><form action="./?module=ZXTS&action=RemoveSymbolicSupport" method="post" id="b" name="b"><button class="fg-button ui-state-default ui-corner-all" id="button" name="button" type="submit" >'
.ui_language::translate('Remove Symbolic Support').'</button></form></td>
                        </tr>
                    </table>

                    '
;

        return 
$Table;
    }
    static function 
getBuildTableAvalibleLanguages(){
        
$getAvalibleLanuages self::dataRetrieval('listLanuages','');
        
$buildTable '';

        foreach(
$getAvalibleLanuages as $number => $infomationArray){
            if(
$number != 'status'){
                
$languageDatabase "tr_".$infomationArray['name']."_tx";

                
$installedTranslations self::languageInstalledPercentage($languageDatabase);
                if(
$installedTranslations == 'NO'){
                    
$CheckInstalled ui_language::translate('Currently Not Installed!');
                }else{
                    
$CheckInstalled '<img src="etc/lib/pChart2/sentora/zProgress.php?percent='.$installedTranslations.'&size=220::20"/>';
                }

                
$buildTable .= '<tr>';//
                    
$buildTable .= '<td width="190">'.$infomationArray['name'].'</td>';
                    
$buildTable .= '<td width="300"><img src="etc/lib/pChart2/sentora/zProgress.php?percent='.$infomationArray['percentage'].'&size=220::20"/></td>';
                    
$buildTable .= '<td width="300">'.$CheckInstalled.'</td>';
                    
$buildTable .= '<td width="200"><form action="./?module=ZXTS&action=InstallLanuage" method="post"><input id="inlanguage" name="inlanguage" type="hidden" value="'.$infomationArray['name'].'"/><button class="fg-button ui-state-default ui-corner-all" id="button" type="submit" >'.ui_language::translate('Install or Update').'</button></form></td>';
                    
$buildTable .= '<td width="200"><form action="./?module=ZXTS&action=UnInstallLanuage" method="post"><input id="inLanguage1" name="inLanguage1" type="hidden" value="'.$infomationArray['name'].'"/><button class="fg-button ui-state-default ui-corner-all" id="button" type="submit" >'.ui_language::translate('Un-Install Lanuage').'</button></form></td>';
                
$buildTable .= '</tr>';
            }
        }

        
$Table '<h2>'.ui_language::translate('Avalible Lanuages').'</h2>';
        
$Table .= '<h4>'.ui_language::translate('PLEASE Read:').'</h4> <span style="color: #D63333;">'.ui_language::translate('The ZXTS will not have all translation for each language this is becuase it only support core module and not custome/additional ones though it will have the bulk of the translation. So if you install a lanuage that is 100% complete that is relative to core module so may not be 100% complete on your server.').'</span><br/><br/>';
        
$Table .= '<table class="zform">';
            
$Table .= '<tr>';
                
$Table .= '<th>'.ui_language::translate('Lanuges').'</th>';
                
$Table .= '<th>'.ui_language::translate('Percentage Complete').'</th>';
                
$Table .= '<th>'.ui_language::translate('Currently Installed').'</th>';
                
$Table .= '<th>'.ui_language::translate('Install or Update').'</th>';
                
$Table .= '<th>'.ui_language::translate('Un-Install Lanuage').'</th>';
            
$Table .= $buildTable;
        
$Table .= '</table>';

        return 
$Table;
    }

 
   static function getModuleName() {
 
       $module_name ui_language::translate(ui_module::GetModuleName());
 
       return $module_name;
 
   }

 
   static function getModuleDesc() {
 
       $message ui_language::translate("Here you can manage your lanuages, install new lanuages from ZXTS, and add support for symbolic lanuages.");
 
       return $message;
 
   }

 
   static function getModuleIcon() {
 
       global $controller;
 
       $module_icon "modules/" $controller->GetControllerRequest('URL''module') . "/assets/icon.png";
 
       return $module_icon;
 
   }


}

?>

With this modifications the blank page be resolved
Reply
Thanks given by: Tango , Cantalupo
#12
RE: Translation
(11-14-2014, 10:40 PM)5050 Wrote: This is because the file /panel/modules/ZXTS/code/controler.ext.php have not been updated for sentora.

It contains:
- a few instances of "zpanel_code" that must be replaced by "sentora_code"
- a few instances of 'etc\styles\zpanelx\  that must be replaced by 'etc\styles\Sentora_Default\
- a few instances of  /pChart2/zpanel/  that must be replaced by b/pChart2/sentora/

For more infos see the dev doc : ZPanel to Sentora migration

I had a error in other module, and when I change zpanel stuffs for sentora.. it worked Tongue
Empty belly not behind joy! Tongue
Reply
Thanks given by:
#13
RE: Translation
Hi!

Ist this plugin useable "as is" with Sentora 1.0.0, or needs it customization in further way?
And is it compatible with another themes? Using the "S-Type Theme".

Asking because the german translation is not only incomplete - it's creepy also. :-P

Thanks
Reply
Thanks given by:


Possibly Related Threads…
Thread Author Replies Views Last Post
Polish Translation Castey 9 28 ,342 09-16-2021, 07:55 PM
Last Post: tlumaczsymultanicznyonline
Brazilian Portuguese Translation Download (Português do Brasil pt-br) 777user 6 22 ,133 03-08-2020, 06:37 PM
Last Post: WesleyD
French Translation Ilia 12 41 ,223 08-26-2017, 05:24 AM
Last Post: Bedo

Forum Jump:


Users browsing this thread: 2 Guest(s)