Moved the Agents into their own repo. Kept the agent.pl just for reference
This commit is contained in:
parent
22381be29a
commit
8680a02b13
18132 changed files with 0 additions and 2569420 deletions
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -1,245 +0,0 @@
|
|||
<?php
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
// | net2ftp: a web based FTP client |
|
||||
// | Copyright (c) 2003-2013 by David Gartner |
|
||||
// | |
|
||||
// | This program 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 2 |
|
||||
// | of the License, or (at your option) any later version. |
|
||||
// | |
|
||||
// -------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// **************************************************************************************
|
||||
// **************************************************************************************
|
||||
// ** **
|
||||
// ** **
|
||||
function getLanguageArray() {
|
||||
|
||||
// --------------
|
||||
// This function returns an array of languages
|
||||
// Use the ISO 639 code described here: http://www.w3.org/WAI/ER/IG/ert/iso639.htm
|
||||
// --------------
|
||||
|
||||
$languageArray["ar"]["name"] = "Arabic";
|
||||
$languageArray["ar"]["file"] = "ar.inc.php";
|
||||
$languageArray["ar-utf"]["name"] = "Arabic UTF-8";
|
||||
$languageArray["ar-utf"]["file"] = "ar-utf.inc.php";
|
||||
$languageArray["zh"]["name"] = "Simplified Chinese";
|
||||
$languageArray["zh"]["file"] = "zh.inc.php";
|
||||
$languageArray["tc"]["name"] = "Traditional Chinese";
|
||||
$languageArray["tc"]["file"] = "tc.inc.php";
|
||||
$languageArray["cs"]["name"] = "Czech";
|
||||
$languageArray["cs"]["file"] = "cs.inc.php";
|
||||
$languageArray["da"]["name"] = "Danish UTF-8";
|
||||
$languageArray["da"]["file"] = "da-utf.inc.php";
|
||||
$languageArray["nl"]["name"] = "Dutch";
|
||||
$languageArray["nl"]["file"] = "nl.inc.php";
|
||||
$languageArray["en"]["name"] = "English";
|
||||
$languageArray["en"]["file"] = "en.inc.php";
|
||||
$languageArray["en-utf"]["name"] = "English UTF-8";
|
||||
$languageArray["en-utf"]["file"] = "en-utf.inc.php";
|
||||
$languageArray["fr"]["name"] = "French";
|
||||
$languageArray["fr"]["file"] = "fr.inc.php";
|
||||
$languageArray["de"]["name"] = "German";
|
||||
$languageArray["de"]["file"] = "de.inc.php";
|
||||
$languageArray["fi"]["name"] = "Finnish";
|
||||
$languageArray["fi"]["file"] = "fi.inc.php";
|
||||
$languageArray["he"]["name"] = "Hebrew";
|
||||
$languageArray["he"]["file"] = "he-utf.inc.php";
|
||||
$languageArray["hu"]["name"] = "Hungarian";
|
||||
$languageArray["hu"]["file"] = "hu.inc.php";
|
||||
$languageArray["hu-utf"]["name"] = "Hungarian UTF-8";
|
||||
$languageArray["hu-utf"]["file"] = "hu-utf.inc.php";
|
||||
$languageArray["it"]["name"] = "Italian";
|
||||
$languageArray["it"]["file"] = "it.inc.php";
|
||||
$languageArray["ja"]["name"] = "Japanese";
|
||||
$languageArray["ja"]["file"] = "ja.inc.php";
|
||||
$languageArray["pl"]["name"] = "Polish";
|
||||
$languageArray["pl"]["file"] = "pl.inc.php";
|
||||
$languageArray["pt"]["name"] = "Portugese";
|
||||
$languageArray["pt"]["file"] = "pt.inc.php";
|
||||
$languageArray["ru"]["name"] = "Russian";
|
||||
$languageArray["ru"]["file"] = "ru.inc.php";
|
||||
$languageArray["es"]["name"] = "Spanish";
|
||||
$languageArray["es"]["file"] = "es.inc.php";
|
||||
$languageArray["sv"]["name"] = "Swedish";
|
||||
$languageArray["sv"]["file"] = "sv.inc.php";
|
||||
$languageArray["tr"]["name"] = "Turkish";
|
||||
$languageArray["tr"]["file"] = "tr.inc.php";
|
||||
$languageArray["ua"]["name"] = "Ukrainian";
|
||||
$languageArray["ua"]["file"] = "ua.inc.php";
|
||||
$languageArray["vi"]["name"] = "Vietnamese";
|
||||
$languageArray["vi"]["file"] = "vi.inc.php";
|
||||
|
||||
return $languageArray;
|
||||
|
||||
} // End function getLanguageArray
|
||||
|
||||
// ** **
|
||||
// ** **
|
||||
// **************************************************************************************
|
||||
// **************************************************************************************
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// **************************************************************************************
|
||||
// **************************************************************************************
|
||||
// ** **
|
||||
// ** **
|
||||
function printLanguageSelect($fieldname, $onchange, $style, $class) {
|
||||
|
||||
|
||||
// --------------
|
||||
// This function prints a select with the available languages
|
||||
// Language nr 1 is the default language
|
||||
// --------------
|
||||
|
||||
global $net2ftp_globals;
|
||||
$languageArray = getLanguageArray();
|
||||
|
||||
if ($net2ftp_globals["language"] != "") { $currentlanguage = $net2ftp_globals["language"]; }
|
||||
else { $currentlanguage = "en"; }
|
||||
|
||||
if ($onchange == "") { $onchange_full = ""; }
|
||||
else { $onchange_full = "onchange=\"$onchange\""; }
|
||||
|
||||
if ($style == "") { $style_full = ""; }
|
||||
else { $style_full = "style=\"$style\""; }
|
||||
|
||||
if ($class == "") { $class_full = ""; }
|
||||
else { $class_full = "class=\"$class\""; }
|
||||
|
||||
echo "<select name=\"$fieldname\" id=\"$fieldname\" $onchange_full $style_full $class_full>\n";
|
||||
|
||||
while (list($key,$value) = each($languageArray)) {
|
||||
// $key loops over "en", "fr", "nl", ...
|
||||
// $value will be an array like $value["name"] = "English" and $value["file"] = "en.inc.php"
|
||||
if ($key == $currentlanguage) { $selected = "selected=\"selected\""; }
|
||||
else { $selected = ""; }
|
||||
echo "<option value=\"" . $key . "\" $selected>" . $value["name"] . "</option>\n";
|
||||
} // end while
|
||||
|
||||
echo "</select>\n";
|
||||
|
||||
} // End function printLanguageSelect
|
||||
|
||||
// ** **
|
||||
// ** **
|
||||
// **************************************************************************************
|
||||
// **************************************************************************************
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// **************************************************************************************
|
||||
// **************************************************************************************
|
||||
// ** **
|
||||
// ** **
|
||||
|
||||
function includeLanguageFile() {
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Global variables
|
||||
// -------------------------------------------------------------------------
|
||||
global $net2ftp_globals, $net2ftp_messages;
|
||||
$languageArray = getLanguageArray();
|
||||
|
||||
// If language exists, include the language file
|
||||
if (array_key_exists($net2ftp_globals["language"], $languageArray) == true) {
|
||||
$languageFile = glueDirectories($net2ftp_globals["application_languagesdir"], $languageArray[$net2ftp_globals["language"]]["file"]);
|
||||
require_once($languageFile);
|
||||
}
|
||||
|
||||
// If it does not exist, use the default language nr "en" (English)
|
||||
else {
|
||||
$net2ftp_globals["language"] = "en";
|
||||
$languageFile = glueDirectories($net2ftp_globals["application_languagesdir"], $languageArray[$net2ftp_globals["language"]]["file"]);
|
||||
require_once($languageFile);
|
||||
}
|
||||
|
||||
} // end function includeLanguageFile
|
||||
|
||||
// ** **
|
||||
// ** **
|
||||
// **************************************************************************************
|
||||
// **************************************************************************************
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// **************************************************************************************
|
||||
// **************************************************************************************
|
||||
// ** **
|
||||
// ** **
|
||||
|
||||
function __() {
|
||||
|
||||
// --------------
|
||||
// This function returns a translated message; the core standard function used is sprintf (see manual)
|
||||
// Input: - from function argument: message name $args[0] and variable parts in the message $args[1], $args[2],...
|
||||
// (there is a variable nr of variable parts)
|
||||
// - from globals: the array of messages $message
|
||||
// Output: string in the language indicated in $net2ftp_language
|
||||
// --------------
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Global variables
|
||||
// -------------------------------------------------------------------------
|
||||
global $net2ftp_globals, $net2ftp_messages;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Get the arguments of this function
|
||||
// $args[0] contains the messagename
|
||||
// $args[1], $args[2], ... contain the variables in the message
|
||||
// -------------------------------------------------------------------------
|
||||
$numargs = func_num_args();
|
||||
$args = func_get_args();
|
||||
$messagename = $args[0];
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Create the argument for the sprintf function
|
||||
// Aim is to have something like: sprintf($string_with_percents, $args[1], $args[2], ...);
|
||||
// As there is a variable nr of arguments in the function __, there is also a variable
|
||||
// nr of arguments in sprintf, and this must be constructed with a loop
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
// Check if the message with that $messagename exists
|
||||
if (@array_key_exists($messagename, $net2ftp_messages)) { $string_with_percents = $net2ftp_messages[$messagename]; }
|
||||
else { return "MESSAGE NOT FOUND $messagename"; }
|
||||
|
||||
$sprintf_argument = "\$translated_string = sprintf(\$string_with_percents";
|
||||
|
||||
for ($i=1; $i<$numargs; $i++) {
|
||||
$sprintf_argument .= ", @htmlentities(\$args[$i], ENT_QUOTES)";
|
||||
} // end for
|
||||
|
||||
$sprintf_argument .= ");";
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Run the sprintf function
|
||||
// -------------------------------------------------------------------------
|
||||
eval($sprintf_argument);
|
||||
|
||||
return $translated_string;
|
||||
|
||||
} // end function __
|
||||
|
||||
// ** **
|
||||
// ** **
|
||||
// **************************************************************************************
|
||||
// **************************************************************************************
|
||||
|
||||
?>
|
||||
|
|
@ -1,282 +0,0 @@
|
|||
<?php
|
||||
|
||||
echo "This script is used for net2ftp development... nothing to see here! ;-)";
|
||||
exit();
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Settings
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
$languagesArray[] = "ar";
|
||||
$languagesArray[] = "ar-utf";
|
||||
$languagesArray[] = "cs";
|
||||
$languagesArray[] = "da-utf";
|
||||
$languagesArray[] = "de";
|
||||
$languagesArray[] = "en";
|
||||
$languagesArray[] = "en-utf";
|
||||
$languagesArray[] = "es";
|
||||
$languagesArray[] = "fr";
|
||||
$languagesArray[] = "fi";
|
||||
$languagesArray[] = "he-utf";
|
||||
$languagesArray[] = "it";
|
||||
$languagesArray[] = "ja";
|
||||
$languagesArray[] = "nl";
|
||||
$languagesArray[] = "pl";
|
||||
$languagesArray[] = "pt";
|
||||
$languagesArray[] = "ru";
|
||||
$languagesArray[] = "sv";
|
||||
$languagesArray[] = "tc";
|
||||
$languagesArray[] = "tr";
|
||||
$languagesArray[] = "ua";
|
||||
$languagesArray[] = "vi";
|
||||
$languagesArray[] = "zh";
|
||||
|
||||
$directory_old = "";
|
||||
$directory_new = "../languages-new";
|
||||
|
||||
$extension = ".inc.php";
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// LOOP: for all language files
|
||||
// -------------------------------------------------------------------------
|
||||
for ($i=0; $i<sizeof($languagesArray); $i++) {
|
||||
|
||||
// ------------------------------------
|
||||
// Send status
|
||||
// ------------------------------------
|
||||
echo "Language $i - " . $languagesArray[$i] . "<br />\n";
|
||||
flush();
|
||||
|
||||
// ------------------------------------
|
||||
// Read the English file and get the lines
|
||||
// ------------------------------------
|
||||
$en_string = local_readfile($directory_old . "en" . $extension);
|
||||
$en_lines = explode_lines($en_string);
|
||||
|
||||
// ------------------------------------
|
||||
// Read the old translated file
|
||||
// ------------------------------------
|
||||
$translated_old_string = local_readfile($directory_old . $languagesArray[$i] . $extension);
|
||||
$translated_old_lines = explode_lines($translated_old_string);
|
||||
|
||||
// $en_lines contains:
|
||||
// [694] => $net2ftp_messages["Zip"] = "Zip";
|
||||
// [695] => $net2ftp_messages["Size"] = "Size";
|
||||
// [696] => $net2ftp_messages["Search"] = "Search";
|
||||
|
||||
// ------------------------------------
|
||||
// Initialize the translated string
|
||||
// ------------------------------------
|
||||
$translated_new_string = "";
|
||||
$translated_new_lines = array();
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// SUBLOOP: for all lines
|
||||
// -------------------------------------------------------------------------
|
||||
for ($j=1; $j<sizeof($en_lines); $j++) {
|
||||
|
||||
// ------------------------------------
|
||||
// Send status
|
||||
// ------------------------------------
|
||||
if ($j % 20 == 0) {
|
||||
echo "Language $i line $j <br />\n";
|
||||
flush();
|
||||
}
|
||||
|
||||
// ------------------------------------
|
||||
// Real messages
|
||||
// ------------------------------------
|
||||
if (substr($en_lines[$j], 0, 1) == "$") {
|
||||
|
||||
// Find the position of the first = character
|
||||
$equalsign_position = strpos($en_lines[$j], "] =");
|
||||
if ($equalsign_position === false || $equalsign_position == false) {
|
||||
echo "Language $i, line $j: Equal sign not found or at first position. String is " . $en_lines[$j] . ". Continuing.<br />\n";
|
||||
$translated_new_lines[$j] = $en_lines[$j];
|
||||
continue;
|
||||
}
|
||||
|
||||
// Add 3 because we looked for "] =" instead of "="
|
||||
else {
|
||||
$equalsign_position = $equalsign_position + 3;
|
||||
}
|
||||
|
||||
// Get the message "$n2f["abd"] ="
|
||||
$message = substr($en_lines[$j], 0, $equalsign_position);
|
||||
|
||||
// Search for the translation
|
||||
$translation = search_translation($message, $translated_old_lines);
|
||||
|
||||
// Debugging info
|
||||
// echo "Language $i, line $j: message is $message, translation is $translation. <br />\n";
|
||||
|
||||
// If the translation is not found, use the English message
|
||||
if ($translation == false) {
|
||||
$translated_new_lines[$j] = $en_lines[$j];
|
||||
}
|
||||
|
||||
// If the translation is found
|
||||
else {
|
||||
$translated_new_lines[$j] = "$message $translation";
|
||||
}
|
||||
|
||||
} // end if
|
||||
|
||||
// ------------------------------------
|
||||
// Comments and control structures
|
||||
// ------------------------------------
|
||||
else {
|
||||
$translated_new_lines[$j] = $en_lines[$j];
|
||||
} // end else
|
||||
|
||||
} // end for
|
||||
|
||||
// ------------------------------------
|
||||
// Write the new translated string to a file
|
||||
// ------------------------------------
|
||||
//print_r($en_lines);
|
||||
//print_r($translated_new_lines);
|
||||
|
||||
// Glue the array to a string
|
||||
$translated_new_string = implode("\n", $translated_new_lines);
|
||||
|
||||
// Write the string to a file
|
||||
local_writefile($directory_new . "/" . $languagesArray[$i] . $extension, $translated_new_string);
|
||||
|
||||
} // end for
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Done
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
echo "Done. <br />\n";
|
||||
|
||||
// **************************************************************************************
|
||||
// **************************************************************************************
|
||||
// ** **
|
||||
// ** **
|
||||
|
||||
function search_translation($message, $translated_old_lines) {
|
||||
|
||||
// --------------
|
||||
// Search an array for a message
|
||||
// --------------
|
||||
|
||||
// Go over all the lines of the old translated file
|
||||
for ($k=0; $k<sizeof($translated_old_lines); $k++) {
|
||||
if (substr($translated_old_lines[$k], 0, strlen($message)) == $message) {
|
||||
$toreturn = substr($translated_old_lines[$k], strlen($message)+1);
|
||||
return $toreturn;
|
||||
}
|
||||
}
|
||||
|
||||
// If nothing is found, return false
|
||||
return false;
|
||||
|
||||
} // end search_translation
|
||||
|
||||
// ** **
|
||||
// ** **
|
||||
// **************************************************************************************
|
||||
// **************************************************************************************
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// **************************************************************************************
|
||||
// **************************************************************************************
|
||||
// ** **
|
||||
// ** **
|
||||
|
||||
function local_readfile($file) {
|
||||
|
||||
// --------------
|
||||
// Open the local file $file and return its content as a string
|
||||
// --------------
|
||||
|
||||
$handle = fopen($file, "rb"); // Open the file for reading only
|
||||
if ($handle == false) { echo "Unable to execute fopen() in local_readfile. Exiting.<br />\n"; exit(); }
|
||||
|
||||
clearstatcache(); // for filesize
|
||||
|
||||
$filesize = filesize($file);
|
||||
if ($filesize == 0) { return ""; }
|
||||
|
||||
$string = fread($handle, $filesize);
|
||||
if ($string == false && filesize($file)>0) { echo "Unable to execute fread() in local_readfile. Exiting.<br />\n"; exit(); }
|
||||
|
||||
$success3 = fclose($handle);
|
||||
if ($success3 == false) { echo "Unable to execute fclose() in local_readfile. Exiting.<br />\n"; exit(); }
|
||||
|
||||
return $string;
|
||||
|
||||
} // end local_readfile
|
||||
|
||||
// ** **
|
||||
// ** **
|
||||
// **************************************************************************************
|
||||
// **************************************************************************************
|
||||
|
||||
|
||||
|
||||
|
||||
// **************************************************************************************
|
||||
// **************************************************************************************
|
||||
// ** **
|
||||
// ** **
|
||||
|
||||
function local_writefile($file, $string) {
|
||||
|
||||
// --------------
|
||||
// Open the local file $file and write the $string to it
|
||||
// --------------
|
||||
|
||||
$handle = fopen($file, "wb");
|
||||
if ($handle == false) { echo "Unable to execute fopen() in local_writefile. Exiting.<br />\n"; exit(); }
|
||||
|
||||
$success1 = fwrite($handle, $string);
|
||||
if ($success1 == false && strlen($string)>0) { echo "Unable to execute fwrite() in local_writefile. Exiting.<br />\n"; exit(); }
|
||||
|
||||
$success2 = fclose($handle);
|
||||
if ($success2 == false) { echo "Unable to execute fclose() in local_writefile. Exiting.<br />\n"; exit(); }
|
||||
|
||||
} // end local_writefile
|
||||
|
||||
// ** **
|
||||
// ** **
|
||||
// **************************************************************************************
|
||||
// **************************************************************************************
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// **************************************************************************************
|
||||
// **************************************************************************************
|
||||
// ** **
|
||||
// ** **
|
||||
|
||||
function explode_lines($string) {
|
||||
|
||||
// --------------
|
||||
// Input: $string which may have Windows or Unix end-of-line characters
|
||||
// Output: $lines array with the lines
|
||||
// --------------
|
||||
|
||||
// $string = standardize_eol($string);
|
||||
|
||||
// Add a \n in the beginning of the strings so that the first line of the string would
|
||||
// be in the first element of the exploded array
|
||||
$lines = explode("\n", "\n" . $string);
|
||||
|
||||
return $lines;
|
||||
|
||||
} // explode_lines
|
||||
|
||||
// ** **
|
||||
// ** **
|
||||
// **************************************************************************************
|
||||
// **************************************************************************************
|
||||
|
||||
?>
|
||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue