mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 21:27:25 +02:00
Feature: Language-Packs can now be downloaded and installed without leaving the admin area.
This commit is contained in:
@@ -359,89 +359,18 @@ class system_tools
|
|||||||
// Developer Mode ONly.. No LANS.
|
// Developer Mode ONly.. No LANS.
|
||||||
private function githubSyncProcess()
|
private function githubSyncProcess()
|
||||||
{
|
{
|
||||||
|
$result = e107::getFile()->unzipGithubArchive('core');
|
||||||
|
|
||||||
// Delete any existing file.
|
if($result === false)
|
||||||
if(file_exists(e_TEMP."e107-master.zip"))
|
|
||||||
{
|
|
||||||
unlink(e_TEMP."e107-master.zip");
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = e107::getFile()->getRemoteFile('https://codeload.github.com/e107inc/e107/zip/master', 'e107-master.zip', 'temp');
|
|
||||||
|
|
||||||
if($result == false)
|
|
||||||
{
|
{
|
||||||
e107::getMessage()->addError( DBLAN_118 );
|
e107::getMessage()->addError( DBLAN_118 );
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$success = $result['success'];
|
||||||
|
$error = $result['error'];
|
||||||
|
|
||||||
$localfile = 'e107-master.zip';
|
// $message = e107::getParser()->lanVars(DBLAN_121, array('x'=>$oldPath, 'y'=>$newPath));
|
||||||
|
|
||||||
chmod(e_TEMP.$localfile, 0755);
|
|
||||||
require_once(e_HANDLER."pclzip.lib.php");
|
|
||||||
|
|
||||||
// $base = realpath(dirname(__FILE__));
|
|
||||||
|
|
||||||
|
|
||||||
$newFolders = array(
|
|
||||||
'e107-master/e107_admin/' => e_BASE.e107::getFolder('ADMIN'),
|
|
||||||
'e107-master/e107_core/' => e_BASE.e107::getFolder('CORE'),
|
|
||||||
'e107-master/e107_docs/' => e_BASE.e107::getFolder('DOCS'),
|
|
||||||
'e107-master/e107_handlers/' => e_BASE.e107::getFolder('HANDLERS'),
|
|
||||||
'e107-master/e107_images/' => e_BASE.e107::getFolder('IMAGES'),
|
|
||||||
'e107-master/e107_languages/' => e_BASE.e107::getFolder('LANGUAGES'),
|
|
||||||
'e107-master/e107_media/' => e_BASE.e107::getFolder('MEDIA'),
|
|
||||||
'e107-master/e107_plugins/' => e_BASE.e107::getFolder('PLUGINS'),
|
|
||||||
'e107-master/e107_system/' => e_BASE.e107::getFolder('SYSTEM'),
|
|
||||||
'e107-master/e107_themes/' => e_BASE.e107::getFolder('THEMES'),
|
|
||||||
'e107-master/e107_web/' => e_BASE.e107::getFolder('WEB'),
|
|
||||||
'e107-master/' => e_BASE
|
|
||||||
);
|
|
||||||
|
|
||||||
$srch = array_keys($newFolders);
|
|
||||||
$repl = array_values($newFolders);
|
|
||||||
|
|
||||||
$archive = new PclZip(e_TEMP.$localfile);
|
|
||||||
$unarc = ($fileList = $archive -> extract(PCLZIP_OPT_PATH, e_TEMP, PCLZIP_OPT_SET_CHMOD, 0755)); // Store in TEMP first.
|
|
||||||
|
|
||||||
$error = array();
|
|
||||||
$success = array();
|
|
||||||
$skipped = array();
|
|
||||||
// print_a($unarc);
|
|
||||||
|
|
||||||
|
|
||||||
$excludes = array('e107-master/','e107-master/install.php','e107-master/favicon.ico');
|
|
||||||
|
|
||||||
foreach($unarc as $k=>$v)
|
|
||||||
{
|
|
||||||
if(in_array($v['stored_filename'],$excludes))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$oldPath = $v['filename'];
|
|
||||||
$newPath = str_replace($srch,$repl, $v['stored_filename']);
|
|
||||||
|
|
||||||
$message = e107::getParser()->lanVars(DBLAN_121, array('x'=>$oldPath, 'y'=>$newPath));
|
|
||||||
|
|
||||||
if($v['folder'] ==1 && is_dir($newPath))
|
|
||||||
{
|
|
||||||
// $skipped[] = $newPath. " (already exists)";
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!rename($oldPath,$newPath))
|
|
||||||
{
|
|
||||||
$error[] = $message;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$success[] = $message;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// echo $message."<br />";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!empty($success))
|
if(!empty($success))
|
||||||
{
|
{
|
||||||
@@ -458,9 +387,6 @@ class system_tools
|
|||||||
e107::getMessage()->addError(print_a($error,true));
|
e107::getMessage()->addError(print_a($error,true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
e107::getRender()->tablerender(DBLAN_10.SEP.DBLAN_112, e107::getMessage()->render());
|
e107::getRender()->tablerender(DBLAN_10.SEP.DBLAN_112, e107::getMessage()->render());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -314,6 +314,7 @@ class lancheck
|
|||||||
|
|
||||||
private $deprecatedFiles = array('lan_download.php', 'lan_parser_functions.php', 'lan_prefs.php', 'admin/lan_download.php', 'admin/lan_modcomment.php');
|
private $deprecatedFiles = array('lan_download.php', 'lan_parser_functions.php', 'lan_prefs.php', 'admin/lan_download.php', 'admin/lan_modcomment.php');
|
||||||
|
|
||||||
|
private $installed_languages = array();
|
||||||
|
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
@@ -346,8 +347,12 @@ class lancheck
|
|||||||
$pref = e107::getPref();
|
$pref = e107::getPref();
|
||||||
|
|
||||||
// Check current theme also (but do NOT add to generated zip)
|
// Check current theme also (but do NOT add to generated zip)
|
||||||
$this->core_themes[] = $pref['sitetheme'];
|
|
||||||
$this->core_themes = array_unique($this->core_themes);
|
if(deftrue('e_DEBUG'))
|
||||||
|
{
|
||||||
|
$this->core_themes[] = $pref['sitetheme'];
|
||||||
|
$this->core_themes = array_unique($this->core_themes);
|
||||||
|
}
|
||||||
|
|
||||||
if(E107_DEBUG_LEVEL > 0)
|
if(E107_DEBUG_LEVEL > 0)
|
||||||
{
|
{
|
||||||
@@ -791,63 +796,34 @@ class lancheck
|
|||||||
return $pzip;
|
return $pzip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List the installed language packs.
|
* Get Installed Language-Pack Meta Data.
|
||||||
* @return
|
* @return array
|
||||||
*/
|
*/
|
||||||
function showLanguagePacks()
|
function getLocalLanguagePacks()
|
||||||
{
|
{
|
||||||
$frm = e107::getForm();
|
$this->installed_languages = e107::getLanguage()->installed();
|
||||||
$ns = e107::getRender();
|
|
||||||
$tp = e107::getParser();
|
|
||||||
|
|
||||||
if(is_readable(e_ADMIN."ver.php"))
|
$xml = e107::getXml();
|
||||||
{
|
|
||||||
include(e_ADMIN."ver.php");
|
|
||||||
list($ver, $tmp) = explode(" ", $e107info['e107_version']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$lans = e107::getLanguage()->installed();
|
$arr = array();
|
||||||
|
|
||||||
$release_diz = defined("LANG_LAN_30") ? LANG_LAN_30 : "Release Date";
|
foreach($this->installed_languages as $language)
|
||||||
$compat_diz = defined("LANG_LAN_31") ? LANG_LAN_31 : "Compatibility";
|
|
||||||
$lan_pleasewait = (deftrue('LAN_PLEASEWAIT')) ? $tp->toJS(LAN_PLEASEWAIT) : "Please Wait";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$text = "<form id='lancheck' method='post' action='".e_REQUEST_URI."'>
|
|
||||||
<table class='table table-striped'>";
|
|
||||||
$text .= "<thead>
|
|
||||||
<tr>
|
|
||||||
<th>".ADLAN_132."</th>
|
|
||||||
<th>".$release_diz."</th>
|
|
||||||
<th>".$compat_diz."</th>
|
|
||||||
<th>".LAN_STATUS."</td>
|
|
||||||
<th style='width:25%;white-space:nowrap'>".LAN_OPTIONS."</td>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
";
|
|
||||||
|
|
||||||
require_once(e_HANDLER."xml_class.php");
|
|
||||||
$xm = new XMLParse();
|
|
||||||
|
|
||||||
foreach($lans as $language)
|
|
||||||
{
|
{
|
||||||
if($language == "English")
|
if($language == "English")
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$metaFile = e_LANGUAGEDIR.$language."/".$language.".xml";
|
$metaFile = e_LANGUAGEDIR.$language."/".$language.".xml";
|
||||||
|
|
||||||
if(is_readable($metaFile))
|
if(is_readable($metaFile))
|
||||||
{
|
{
|
||||||
$rawData = file_get_contents($metaFile);
|
$rawData = $xml->loadXMLfile($metaFile,true);
|
||||||
|
|
||||||
if($rawData)
|
if($rawData)
|
||||||
{
|
{
|
||||||
$array = $xm->parse($rawData);
|
$value = $rawData['@attributes'];
|
||||||
$value = $array['e107Language']['attributes'];
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -865,148 +841,68 @@ class lancheck
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$errFound = (isset($_SESSION['lancheck'][$language]['total']) && $_SESSION['lancheck'][$language]['total'] > 0) ? TRUE : FALSE;
|
$value['type'] = 'local';
|
||||||
|
|
||||||
|
$arr[$language] = $value;
|
||||||
$text .= "<tr>
|
|
||||||
<td >".$language."</td>
|
|
||||||
<td>".$value['date']."</td>
|
|
||||||
<td>".$value['compatibility']."</td>
|
|
||||||
<td>".($ver != $value['compatibility'] || $errFound ? ADMIN_FALSE_ICON : ADMIN_TRUE_ICON )."</td>
|
|
||||||
<td>";
|
|
||||||
|
|
||||||
// $text .= "<input type='submit' name='language_sel[{$language}]' value=\"".LAN_CHECK_2."\" class='btn btn-primary' />";
|
|
||||||
$text .= "<a href='".e_REQUEST_URI."&sub=verify&lan=".$language."' class='btn btn-primary' >".LAN_CHECK_2."</a>";
|
|
||||||
|
|
||||||
$text .= "
|
|
||||||
<input type='submit' name='ziplang[{$language}]' value=\"".LANG_LAN_23."\" class='btn btn-default' onclick=\"this.value = '".$lan_pleasewait."'\" /></td>
|
|
||||||
</tr>";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$text .= "
|
return $arr;
|
||||||
|
|
||||||
</tr></table>";
|
|
||||||
|
|
||||||
$text .= "<table class='table table-striped'>";
|
|
||||||
|
|
||||||
$text .= "<thead><tr><th>".LAN_OPTIONS."</th></tr></thead><tbody>";
|
|
||||||
|
|
||||||
$srch = array("[","]");
|
|
||||||
$repl = array("<a rel='external' href='https://github.com/orgs/e107translations/teams'>","</a>");
|
|
||||||
$diz = (deftrue("LANG_LAN_28")) ? LANG_LAN_28 : "Check this box if you are a member of the [e107 translation team].";
|
|
||||||
|
|
||||||
$checked = varset($_COOKIE['e107_certified']) == 1 ? true : false;
|
|
||||||
|
|
||||||
$text .= "<tr><td>";
|
|
||||||
$text .= $frm->checkbox('contribute_pack',1,$checked,array('label'=>str_replace($srch,$repl,$diz)));
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
$text .= "</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>";
|
|
||||||
|
|
||||||
// $echecked = varset($_SESSION['lancheck-errors-only']) == 1 ? true : false;
|
|
||||||
// $text .= $frm->checkbox('errorsonly',1,$echecked,array('label'=>$lan_displayerrors));
|
|
||||||
$text .= " </td>
|
|
||||||
|
|
||||||
</tr>";
|
|
||||||
|
|
||||||
// $text .= "
|
|
||||||
// <tr>
|
|
||||||
// <td>".$frm->checkbox('non-core-plugs-themes',1,$echecked,array('label'=>$lan_displayerrors))."</td>
|
|
||||||
// </tr>
|
|
||||||
// ";
|
|
||||||
|
|
||||||
$text .= "</tbody></table>";
|
|
||||||
|
|
||||||
|
|
||||||
$text .= "</form>";
|
|
||||||
|
|
||||||
$text .= "<div class='smalltext center' style='padding-top:50px'>".LANG_LAN_AGR."</div>";
|
|
||||||
|
|
||||||
$text .= $this->onlineLanguagePacks();
|
|
||||||
|
|
||||||
return $text;
|
|
||||||
|
|
||||||
return;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private function onlineLanguagePacks()
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Online Language-Pack Meta Data.
|
||||||
|
* @return array|bool
|
||||||
|
*/
|
||||||
|
public function getOnlineLanguagePacks()
|
||||||
{
|
{
|
||||||
$xml = e107::getXml();
|
$xml = e107::getXml();
|
||||||
|
|
||||||
$feed = e107::getPref('xmlfeed_languagepacks');
|
$feed = 'https://e107.org/languagepacks.xml';
|
||||||
|
|
||||||
$text = '';
|
$languages = array();
|
||||||
|
|
||||||
if($rawData = $xml -> loadXMLfile($feed, TRUE))
|
if($rawData = $xml -> loadXMLfile($feed, TRUE))
|
||||||
{
|
{
|
||||||
if(!varset($rawData['language']))
|
|
||||||
|
if(empty($rawData['language']))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$text .= "<div class='block-text'>".LANG_LAN_35."</div>";
|
|
||||||
$text .= "<table class='table adminlist'>";
|
|
||||||
foreach($rawData['language'] as $val)
|
foreach($rawData['language'] as $val)
|
||||||
{
|
{
|
||||||
$att = $val['@attributes'];
|
$att = $val['@attributes'];
|
||||||
$name = $att['folder'];
|
|
||||||
$languages[$name] = array(
|
$id = $att['name'];
|
||||||
'name' => $att['name'],
|
|
||||||
'author' => $att['author'],
|
$languages[$id] = array(
|
||||||
'authorURL' => $att['authorURL'],
|
'name' => $att['name'],
|
||||||
'folder' => $att['folder'],
|
'author' => $att['author'],
|
||||||
'version' => $att['version'],
|
'infoURL' => $att['infourl'],
|
||||||
'date' => $att['date'],
|
// 'folder' => $att['folder'],
|
||||||
|
'version' => $att['version'],
|
||||||
|
'date' => $att['date'],
|
||||||
'compatibility' => $att['compatibility'],
|
'compatibility' => $att['compatibility'],
|
||||||
'url' => $att['url']
|
'url' => $att['url'],
|
||||||
|
'type' => 'online'
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ksort($languages);
|
|
||||||
|
|
||||||
$text .= "<thead>
|
|
||||||
<tr>
|
|
||||||
<th>".LAN_NAME."</th>
|
|
||||||
<th>".LAN_VERSION."</th>
|
|
||||||
<th>".LAN_AUTHOR."</th>
|
|
||||||
<th>".LANG_LAN_111."</th>
|
|
||||||
<th>".LANG_LAN_112."</th>
|
|
||||||
<th>".LAN_DOWNLOAD."</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>";
|
|
||||||
|
|
||||||
foreach($languages as $value)
|
|
||||||
{
|
|
||||||
$text .= "<tr>
|
|
||||||
<td>".$value['name']."</td>
|
|
||||||
<td>".$value['version']."</td>
|
|
||||||
<td><a href='".$value['authorURL']."'>".$value['author']."</a></td>
|
|
||||||
<td>".$value['date']."</td>
|
|
||||||
<td>".$value['compatibility']."</td>
|
|
||||||
|
|
||||||
<td><a href='".$value['url']."'>".LANG_LAN_114."</a></td>
|
|
||||||
</tr>";
|
|
||||||
}
|
|
||||||
|
|
||||||
$text .= "</tbody></table>";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return $text;
|
return $languages;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function check_all($mode='render', $lan=null)
|
function check_all($mode='render', $lan=null)
|
||||||
{
|
{
|
||||||
// global $ns,$tp;
|
// global $ns,$tp;
|
||||||
@@ -1081,14 +977,14 @@ class lancheck
|
|||||||
}
|
}
|
||||||
|
|
||||||
$message = "
|
$message = "
|
||||||
<form id='lancheck' method='post' action='".e_ADMIN."language.php?tools'>
|
<form id='lancheck' method='post' action='".e_ADMIN."language.php?mode=main&action=tools'>
|
||||||
<div>\n";
|
<div>\n";
|
||||||
|
|
||||||
$icon = ($_SESSION['lancheck'][$lan]['total']>0) ? ADMIN_FALSE_ICON : ADMIN_TRUE_ICON;
|
$icon = ($_SESSION['lancheck'][$lan]['total']>0) ? ADMIN_FALSE_ICON : ADMIN_TRUE_ICON;
|
||||||
|
|
||||||
|
|
||||||
$errors_diz = (deftrue('LAN_CHECK_23')) ? LAN_CHECK_23 : "Errors Found";
|
$errors_diz = (deftrue('LAN_CHECK_23')) ? LAN_CHECK_23 : "Errors Found";
|
||||||
|
|
||||||
$message .= $errors_diz.": ".$_SESSION['lancheck'][$lan]['total'];
|
$message .= $errors_diz.": ".$_SESSION['lancheck'][$lan]['total'];
|
||||||
|
|
||||||
$just_go_diz = (deftrue('LAN_CHECK_20')) ? LAN_CHECK_20 : "Generate Language Pack";
|
$just_go_diz = (deftrue('LAN_CHECK_20')) ? LAN_CHECK_20 : "Generate Language Pack";
|
||||||
@@ -1361,7 +1257,7 @@ class lancheck
|
|||||||
$style = ($er) ? "forumheader2" : "forumheader3";
|
$style = ($er) ? "forumheader2" : "forumheader3";
|
||||||
$text .= "<td class='{$style}' style='width:50%'><div class='smalltext'>";
|
$text .= "<td class='{$style}' style='width:50%'><div class='smalltext'>";
|
||||||
$text .= $bom_error . $utf_error;
|
$text .= $bom_error . $utf_error;
|
||||||
$text .= (!$er && !$bom_error && !$utf_error) ? "<img src='".e_IMAGE."fileinspector/integrity_pass.png' alt='".LAN_OK."' />" : $er."<br />";
|
$text .= (!$er && !$bom_error && !$utf_error) ? ADMIN_TRUE_ICON : $er."<br />";
|
||||||
$text .= "</div></td>";
|
$text .= "</div></td>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1722,7 +1618,7 @@ class lancheck
|
|||||||
$style = ($er) ? "forumheader2" : "forumheader3";
|
$style = ($er) ? "forumheader2" : "forumheader3";
|
||||||
$text .= "<td class='{$style}' style='width:50%'><div class='smalltext'>";
|
$text .= "<td class='{$style}' style='width:50%'><div class='smalltext'>";
|
||||||
$text .= $bom_error . $utf_error;
|
$text .= $bom_error . $utf_error;
|
||||||
$text .= (!$er && !$bom_error && !$utf_error) ? "<img src='".e_IMAGE."fileinspector/integrity_pass.png' alt='".LAN_OK."' />" : $er."<br />";
|
$text .= (!$er && !$bom_error && !$utf_error) ? ADMIN_TRUE_ICON : $er."<br />";
|
||||||
$text .= "</div></td>";
|
$text .= "</div></td>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -54,7 +54,8 @@ if(!empty($_GET['iframe']))
|
|||||||
);
|
);
|
||||||
|
|
||||||
protected $adminMenuAliases = array(
|
protected $adminMenuAliases = array(
|
||||||
'main/edit' => 'main/list'
|
'main/edit' => 'main/list',
|
||||||
|
// 'main/download' => 'main/tools'
|
||||||
);
|
);
|
||||||
|
|
||||||
protected $adminMenuIcon = 'e-language-24';
|
protected $adminMenuIcon = 'e-language-24';
|
||||||
@@ -123,12 +124,31 @@ if(!empty($_GET['iframe']))
|
|||||||
);
|
);
|
||||||
|
|
||||||
protected $installedLanguages = array();
|
protected $installedLanguages = array();
|
||||||
|
protected $localPacks = array();
|
||||||
|
protected $onlinePacks = array();
|
||||||
|
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
$this->installedLanguages = e107::getLanguage()->installed();
|
$this->installedLanguages = e107::getLanguage()->installed();
|
||||||
$this->prefs['sitelanguage']['writeParms']['optArray'] = $this->installedLanguages;
|
$this->prefs['sitelanguage']['writeParms']['optArray'] = $this->installedLanguages;
|
||||||
$this->prefs['adminlanguage']['writeParms']['optArray'] = $this->installedLanguages;
|
$this->prefs['adminlanguage']['writeParms']['optArray'] = $this->installedLanguages;
|
||||||
|
|
||||||
|
e107::css('inline', "
|
||||||
|
|
||||||
|
.language-name { padding-left:15px }
|
||||||
|
|
||||||
|
");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private function loadPackInfo()
|
||||||
|
{
|
||||||
|
$lck = e107::getSingleton('lancheck', e_ADMIN."lancheck.php");
|
||||||
|
|
||||||
|
$this->onlinePacks = $lck->getOnlineLanguagePacks();
|
||||||
|
$this->localPacks = $lck->getLocalLanguagePacks();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -153,8 +173,11 @@ if(!empty($_GET['iframe']))
|
|||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
function toolsPage()
|
|
||||||
|
|
||||||
|
function ToolsPage()
|
||||||
{
|
{
|
||||||
|
$this->loadPackInfo();
|
||||||
$pref = e107::getPref();
|
$pref = e107::getPref();
|
||||||
$lck = e107::getSingleton('lancheck', e_ADMIN."lancheck.php");
|
$lck = e107::getSingleton('lancheck', e_ADMIN."lancheck.php");
|
||||||
|
|
||||||
@@ -172,24 +195,234 @@ if(!empty($_GET['iframe']))
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$text = $lck->showLanguagePacks();
|
return $this->renderLanguagePacks();
|
||||||
|
|
||||||
|
|
||||||
//e107::getRender()->tablerender(ADLAN_132.SEP.LANG_LAN_32, $text);
|
}
|
||||||
|
|
||||||
//return;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// e107::getRender()->tablerender(ADLAN_132.SEP."Core Language-Pack Developer", );
|
function DownloadPage()
|
||||||
|
{
|
||||||
|
$this->loadPackInfo();
|
||||||
|
|
||||||
|
$lan = $this->getId();
|
||||||
|
|
||||||
|
if(empty($lan))
|
||||||
|
{
|
||||||
|
return LAN_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(empty($this->onlinePacks[$lan]['url']))
|
||||||
|
{
|
||||||
|
return LAN_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$result = e107::getFile()->unzipGithubArchive($this->onlinePacks[$lan]['url']);
|
||||||
|
|
||||||
|
if(!empty($result['success']))
|
||||||
|
{
|
||||||
|
e107::getMessage()->addSuccess(print_a($result['success'],true));
|
||||||
|
$_SESSION['lancheck'][$lan]['total'] = 0; // reset errors to zero.
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($result['error']))
|
||||||
|
{
|
||||||
|
e107::getMessage()->addError(print_a($result['error'],true));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->addTitle(LANG_LAN_114);
|
||||||
|
$this->addTitle($lan);
|
||||||
|
|
||||||
|
|
||||||
|
return e107::getMessage()->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List the installed language packs.
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private function renderLanguagePacks()
|
||||||
|
{
|
||||||
|
$frm = e107::getForm();
|
||||||
|
$ns = e107::getRender();
|
||||||
|
$tp = e107::getParser();
|
||||||
|
|
||||||
|
if(is_readable(e_ADMIN."ver.php"))
|
||||||
|
{
|
||||||
|
include(e_ADMIN."ver.php");
|
||||||
|
list($ver, $tmp) = explode(" ", $e107info['e107_version']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$lck = e107::getSingleton('lancheck', e_ADMIN."lancheck.php");
|
||||||
|
|
||||||
|
$release_diz = defset("LANG_LAN_30","Release Date");
|
||||||
|
$compat_diz = defset("LANG_LAN_31", "Compatibility");
|
||||||
|
$lan_pleasewait = (deftrue('LAN_PLEASEWAIT')) ? $tp->toJS(LAN_PLEASEWAIT) : "Please Wait";
|
||||||
|
|
||||||
|
|
||||||
|
$text = "<form id='lancheck' method='post' action='".e_REQUEST_URI."'>
|
||||||
|
<table class='table adminlist table-striped'>
|
||||||
|
<colgroup>
|
||||||
|
<col style='width:20%' />
|
||||||
|
<col style='width:20%' />
|
||||||
|
<col style='width:20%' />
|
||||||
|
<col style='width:15%' />
|
||||||
|
<col style='width:25%' />
|
||||||
|
</colgroup>";
|
||||||
|
$text .= "<thead>
|
||||||
|
<tr>
|
||||||
|
<th>".ADLAN_132."</th>
|
||||||
|
<th class='text-center'>".$release_diz."</th>
|
||||||
|
<th class='text-center'>".$compat_diz."</th>
|
||||||
|
<th class='text-center'>".LAN_STATUS."</td>
|
||||||
|
<th class='text-right' style='white-space:nowrap'>".LAN_OPTIONS."</td>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
";
|
||||||
|
|
||||||
|
$text .= "<tr><th colspan='5'>".LAN_INSTALLED."</th></tr>";
|
||||||
|
|
||||||
|
// $onlinePacks = $lck->getOnlineLanguagePacks();
|
||||||
|
// $localPacks = $lck->getLocalLanguagePacks();
|
||||||
|
|
||||||
|
foreach($this->localPacks as $language=>$value)
|
||||||
|
{
|
||||||
|
|
||||||
|
$errFound = (isset($_SESSION['lancheck'][$language]['total']) && $_SESSION['lancheck'][$language]['total'] > 0) ? TRUE : FALSE;
|
||||||
|
|
||||||
|
|
||||||
|
$text .= "<tr>
|
||||||
|
<td><span class='language-name'>".$language."</a></td>
|
||||||
|
<td class='text-center'>".$value['date']."</td>
|
||||||
|
<td class='text-center'>".$value['compatibility']."</td>
|
||||||
|
<td class='text-center'>".( $errFound ? ADMIN_FALSE_ICON : ADMIN_TRUE_ICON )."</td>
|
||||||
|
<td class='text-right'>";
|
||||||
|
|
||||||
|
// $text .= "<input type='submit' name='language_sel[{$language}]' value=\"".LAN_CHECK_2."\" class='btn btn-primary' />";
|
||||||
|
$text .= "<a href='".e_REQUEST_URI."&sub=verify&lan=".$language."' class='btn btn-default' >".$tp->toGlyph('fa-search').LAN_CHECK_2."</a>";
|
||||||
|
|
||||||
|
/* $text .= "
|
||||||
|
<input type='submit' name='ziplang[{$language}]' value=\"".LANG_LAN_23."\" class='btn btn-default' onclick=\"this.value = '".$lan_pleasewait."'\" />";
|
||||||
|
*/
|
||||||
|
$text .= "</td>
|
||||||
|
</tr>";
|
||||||
|
}
|
||||||
|
|
||||||
|
$text .= "<tr><th colspan='5'>".defset('LANG_LAN_151','Available')."</th></tr>"; // don't translate this.
|
||||||
|
|
||||||
|
$text .= $this->renderOnlineLanguagePacks();
|
||||||
|
|
||||||
|
$text .= "
|
||||||
|
</tr></table>";
|
||||||
|
|
||||||
|
$creditLan = defset('LANG_LAN_152', "Courtesy of the [e107 translation team]"); // don't translate this.
|
||||||
|
|
||||||
|
$srch = array("[","]");
|
||||||
|
$repl = array("<a rel='external' href='https://github.com/orgs/e107translations/teams'>","</a>");
|
||||||
|
|
||||||
|
$text .= "<div class='nav navbar'><small class='navbar-text'>".str_replace($srch,$repl,$creditLan)."</small></div>";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
$text .= "<table class='table table-striped'>";
|
||||||
|
|
||||||
|
$text .= "<thead><tr><th>".LAN_OPTIONS."</th></tr></thead><tbody>";
|
||||||
|
|
||||||
|
$srch = array("[","]");
|
||||||
|
$repl = array("<a rel='external' href='https://github.com/orgs/e107translations/teams'>","</a>");
|
||||||
|
$diz = (deftrue("LANG_LAN_28")) ? LANG_LAN_28 : "Check this box if you are a member of the [e107 translation team].";
|
||||||
|
|
||||||
|
$checked = varset($_COOKIE['e107_certified']) == 1 ? true : false;
|
||||||
|
|
||||||
|
$text .= "<tr><td>";
|
||||||
|
$text .= $frm->checkbox('contribute_pack',1,$checked,array('label'=>str_replace($srch,$repl,$diz)));
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
$text .= "</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>";
|
||||||
|
|
||||||
|
$text .= " </td>
|
||||||
|
</tr>";
|
||||||
|
|
||||||
|
$text .= "</tbody></table>";
|
||||||
|
*/
|
||||||
|
|
||||||
|
$text .= "</form>";
|
||||||
|
|
||||||
|
// $text .= "<div class='text-right text-muted' style='padding-top:50px'><small>".LANG_LAN_AGR."</small></div>";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return $text;
|
return $text;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function renderOnlineLanguagePacks()
|
||||||
|
{
|
||||||
|
|
||||||
|
$text = '';
|
||||||
|
|
||||||
|
$tp = e107::getParser();
|
||||||
|
|
||||||
|
foreach($this->onlinePacks as $lan=>$value)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(!empty($this->localPacks[$lan]))
|
||||||
|
{
|
||||||
|
|
||||||
|
if($this->localPacks[$lan]['compatibility'] == $value['compatibility'] && !deftrue('e_DEBUG'))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// $status = $tp->toGlyph('fa-star');
|
||||||
|
$class = 'btn-primary';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$status = " ";
|
||||||
|
$class = 'btn-default';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$text .= "<tr>
|
||||||
|
<td><span class='language-name'><a rel='external' href='".$value['infoURL']."' title=\"".LAN_MOREINFO."\">".$value['name']."</a></span></td>";
|
||||||
|
|
||||||
|
/* $text .= "
|
||||||
|
<td>".$value['version']."</td>
|
||||||
|
<td><a href='".$value['authorURL']."'>".$value['author']."</a></td>";*/
|
||||||
|
|
||||||
|
|
||||||
|
$url = 'language.php?mode=main&action=download&id='.$value['name']; // $value['url']
|
||||||
|
|
||||||
|
$text .= "
|
||||||
|
<td class='text-center'>".$value['date']."</td>
|
||||||
|
<td class='text-center'>".$value['compatibility']."</td>
|
||||||
|
<td class='text-center'>".$status."</td>
|
||||||
|
<td class='text-right'><a class='btn ".$class."' href='".$url."'><i class='fa fa-arrow-down'></i> ".ADLAN_121."</a></td>
|
||||||
|
</tr>";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $text;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private function getTables()
|
private function getTables()
|
||||||
{
|
{
|
||||||
// grab default language lists.
|
// grab default language lists.
|
||||||
|
@@ -1511,4 +1511,143 @@ class e_file
|
|||||||
return $limits;
|
return $limits;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function unzipGithubArchive($url='core')
|
||||||
|
{
|
||||||
|
|
||||||
|
switch($url)
|
||||||
|
{
|
||||||
|
case "core":
|
||||||
|
$localfile = 'e107-master.zip';
|
||||||
|
$remotefile = 'https://codeload.github.com/e107inc/e107/zip/master';
|
||||||
|
$excludes = array('e107-master/install.php','e107-master/favicon.ico');
|
||||||
|
$excludeMatch = false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
// language.
|
||||||
|
// eg. https://github.com/e107translations/Spanish/archive/v2.1.5.zip
|
||||||
|
default:
|
||||||
|
$localfile = str_replace('https://github.com/e107translations/','',$url); // 'e107-master.zip';
|
||||||
|
$localfile = str_replace('/archive/v','-',$localfile); //remove dirs.
|
||||||
|
$remotefile = $url;
|
||||||
|
$excludes = array();
|
||||||
|
$excludeMatch = array('alt_auth','tagwords','faqs');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete any existing file.
|
||||||
|
if(file_exists(e_TEMP.$localfile))
|
||||||
|
{
|
||||||
|
unlink(e_TEMP.$localfile);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->getRemoteFile($remotefile, $localfile, 'temp');
|
||||||
|
|
||||||
|
if($result === false)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
chmod(e_TEMP.$localfile, 0755);
|
||||||
|
require_once(e_HANDLER."pclzip.lib.php");
|
||||||
|
|
||||||
|
$zipBase = str_replace('.zip','',$localfile); // eg. e107-master
|
||||||
|
$excludes[] = $zipBase;
|
||||||
|
|
||||||
|
$newFolders = array(
|
||||||
|
$zipBase.'/e107_admin/' => e_BASE.e107::getFolder('ADMIN'),
|
||||||
|
$zipBase.'/e107_core/' => e_BASE.e107::getFolder('CORE'),
|
||||||
|
$zipBase.'/e107_docs/' => e_BASE.e107::getFolder('DOCS'),
|
||||||
|
$zipBase.'/e107_handlers/' => e_BASE.e107::getFolder('HANDLERS'),
|
||||||
|
$zipBase.'/e107_images/' => e_BASE.e107::getFolder('IMAGES'),
|
||||||
|
$zipBase.'/e107_languages/' => e_BASE.e107::getFolder('LANGUAGES'),
|
||||||
|
$zipBase.'/e107_media/' => e_BASE.e107::getFolder('MEDIA'),
|
||||||
|
$zipBase.'/e107_plugins/' => e_BASE.e107::getFolder('PLUGINS'),
|
||||||
|
$zipBase.'/e107_system/' => e_BASE.e107::getFolder('SYSTEM'),
|
||||||
|
$zipBase.'/e107_themes/' => e_BASE.e107::getFolder('THEMES'),
|
||||||
|
$zipBase.'/e107_web/' => e_BASE.e107::getFolder('WEB'),
|
||||||
|
$zipBase.'/' => e_BASE
|
||||||
|
);
|
||||||
|
|
||||||
|
$srch = array_keys($newFolders);
|
||||||
|
$repl = array_values($newFolders);
|
||||||
|
|
||||||
|
$archive = new PclZip(e_TEMP.$localfile);
|
||||||
|
$unarc = ($fileList = $archive -> extract(PCLZIP_OPT_PATH, e_TEMP, PCLZIP_OPT_SET_CHMOD, 0755)); // Store in TEMP first.
|
||||||
|
|
||||||
|
$error = array();
|
||||||
|
$success = array();
|
||||||
|
// $skipped = array();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
foreach($unarc as $k=>$v)
|
||||||
|
{
|
||||||
|
if($this->matchFound($v['stored_filename'],$excludeMatch))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(in_array($v['stored_filename'],$excludes))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$oldPath = $v['filename'];
|
||||||
|
$newPath = str_replace($srch,$repl, $v['stored_filename']);
|
||||||
|
|
||||||
|
/*
|
||||||
|
$success[] = $newPath;
|
||||||
|
continue;*/
|
||||||
|
|
||||||
|
if($v['folder'] ==1 && is_dir($newPath))
|
||||||
|
{
|
||||||
|
// $skipped[] = $newPath. " (already exists)";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!rename($oldPath,$newPath))
|
||||||
|
{
|
||||||
|
$error[] = $newPath;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$success[] = $newPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return array('success'=>$success, 'error'=>$error);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private function matchFound($file,$array)
|
||||||
|
{
|
||||||
|
if(empty($array))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($array as $term)
|
||||||
|
{
|
||||||
|
if(strpos($file,$term)!==false)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -894,13 +894,13 @@ class e107plugin
|
|||||||
|
|
||||||
|
|
||||||
protected $core_plugins = array(
|
protected $core_plugins = array(
|
||||||
"_blank","admin_menu","alt_auth","banner","blogcalendar_menu",
|
"_blank","admin_menu","banner","blogcalendar_menu",
|
||||||
"chatbox_menu", "clock_menu","comment_menu",
|
"chatbox_menu", "clock_menu","comment_menu",
|
||||||
"contact", "download","faqs", "featurebox", "forum","gallery",
|
"contact", "download", "featurebox", "forum","gallery",
|
||||||
"gsitemap","import", "linkwords", "list_new", "log", "login_menu",
|
"gsitemap","import", "linkwords", "list_new", "log", "login_menu",
|
||||||
"metaweblog", "newforumposts_main", "news", "newsfeed",
|
"metaweblog", "newforumposts_main", "news", "newsfeed",
|
||||||
"newsletter","online", "page", "pm","poll",
|
"newsletter","online", "page", "pm","poll",
|
||||||
"rss_menu","search_menu","siteinfo", "social", "tagwords", "tinymce4",
|
"rss_menu","search_menu","siteinfo", "social", "tagcloud", "tinymce4",
|
||||||
"trackback","tree_menu","user"
|
"trackback","tree_menu","user"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@@ -43,4 +43,4 @@ define("LANG_LAN_120", "Please make sure you are using default folder names in e
|
|||||||
define("LANG_LAN_AGR", "Note: By using these tools you agree to share your language pack(s) with the e107 community.");
|
define("LANG_LAN_AGR", "Note: By using these tools you agree to share your language pack(s) with the e107 community.");
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
@@ -65,4 +65,9 @@ define("LANG_LAN_144", "Must be re-enabled");
|
|||||||
define("LANG_LAN_148", "Normal Mode");
|
define("LANG_LAN_148", "Normal Mode");
|
||||||
define("LANG_LAN_149", "Value");
|
define("LANG_LAN_149", "Value");
|
||||||
define("LANG_LAN_150", "[b]Search ENTIRE core before commenting out ANY LAN from ANY language file.[/b]");
|
define("LANG_LAN_150", "[b]Search ENTIRE core before commenting out ANY LAN from ANY language file.[/b]");
|
||||||
?>
|
|
||||||
|
define("LANG_LAN_151", "Available");
|
||||||
|
define("LANG_LAN_152", "Courtesy of the [e107 translations team]");
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
Reference in New Issue
Block a user