Skip to content

Commit 21ab41e

Browse files
committed
Placeholder vars added for more lang pieces
1 parent b8f0270 commit 21ab41e

6 files changed

Lines changed: 100 additions & 93 deletions

File tree

lib/get-branch.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
header("Location: ../");
99
}
1010

11+
$text = $_SESSION['text'];
12+
$t = $text['get-branch'];
1113
?>
1214
<!DOCTYPE html>
1315
<html>
@@ -213,7 +215,7 @@ function parseGitignore($file) { # $file = '/absolute/path/to/.gitignore'
213215
repoSHAArray = [];
214216

215217
// Set our repo and get the tree recursively
216-
var repo = github.getRepo(top.repo.split("/")[0], top.repo.split("/")[1]);
218+
var repo = github.getRepo(top.repo.split("/")[0], top.repo.split("/")[1]);
217219
repo.getTree('master?recursive=true', function(err, tree) {
218220
if(!err) {
219221
treePaths = [];
@@ -288,7 +290,7 @@ function parseGitignore($file) { # $file = '/absolute/path/to/.gitignore'
288290
// If there are no diffs, ask user if they want to switch back to regular mode
289291
setTimeout(function(){
290292
if (parent.document.getElementById('|').parentNode.parentNode.parentNode.childNodes[2].childNodes.length==1) {
291-
if(top.ICEcoder.ask('There are no differences between the local and GitHub repo. Switch back to regular mode?')) {
293+
if(top.ICEcoder.ask('<?php echo $t['There are no...'];?>')) {
292294
top.ICEcoder.githubDiffToggle();
293295
} else {
294296
top.ICEcoder.showHide('hide',top.get('loadingMask'));
@@ -300,7 +302,7 @@ function parseGitignore($file) { # $file = '/absolute/path/to/.gitignore'
300302
},4);
301303
} else {
302304
// There was an error, display HTTP error code and response message
303-
top.ICEcoder.message('Sorry, there was an error, code: '+err.error+'\n\n'+err.request.response);
305+
top.ICEcoder.message('<?php echo $t['Sorry, there was...'];?> '+err.error+'\n\n'+err.request.response);
304306
top.ICEcoder.showHide('hide',top.get('loadingMask'));
305307
}
306308
});
@@ -364,7 +366,7 @@ function parseGitignore($file) { # $file = '/absolute/path/to/.gitignore'
364366
$pathPos = array_search($iceRoot,$iceGithubLocalPaths);
365367
if ($pathPos !== false) {
366368
?>
367-
if (top.ICEcoder.ask("Your local folder is empty, would you like to clone <?php echo $iceGithubRemotePaths[$pathPos];?>?")) {
369+
if (top.ICEcoder.ask("<?php echo $t['Your local folder...'];?> <?php echo $iceGithubRemotePaths[$pathPos];?>?")) {
368370
setTimeout(function() {
369371
top.ICEcoder.showHide('show',top.get('loadingMask'));
370372
top.ICEcoder.filesFrame.contentWindow.frames['fileControl'].location.href = "github.php?action=clone&csrf="+top.ICEcoder.csrf;

lib/github-manager.php

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22
include("headers.php");
33
include("settings.php");
4+
$t = $text['github-manager'];
45

56
// If we have an action to perform
67
if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset($_GET['action'])) {
@@ -26,7 +27,7 @@
2627
if (is_writable($docRoot)) {
2728
mkdir($docRoot.$chosenLocal, 0705);
2829
} else {
29-
echo "<script>top.ICEcoder.message('Sorry, cannot create folder at\\n".$chosenLocal."');</script>";
30+
echo "<script>top.ICEcoder.message('".$t['Sorry, cannot create...']."\\n".$chosenLocal."');</script>";
3031
}
3132
}
3233

@@ -54,9 +55,9 @@
5455
// Hide this popup and reload file manager
5556
echo "<script>top.ICEcoder.showHide('hide',top.document.getElementById('blackMask'));top.ICEcoder.refreshFileManager();</script>";
5657
} else {
57-
echo "<script>top.ICEcoder.message('Cannot update config file. Please set public write permissions on lib/".$settingsFile." and try again');</script>";
58+
echo "<script>top.ICEcoder.message('".$t['Cannot update config...']." lib/".$settingsFile." ".$t['and try again']."');</script>";
5859
}
59-
60+
6061
}
6162

6263
}
@@ -153,9 +154,9 @@
153154
// Finally, reload the iFrame screen for the user
154155
header("Location: github-manager.php?updatedGithubPaths&csrf=".$_SESSION["csrf"]);
155156
echo "<script>window.location='github-manager.php?updatedGithubPaths&csrf='+top.ICEcoder.csrf;</script>";
156-
die('saving github paths...');
157+
die($t['saving github paths']);
157158
} else {
158-
echo "<script>top.ICEcoder.message('Cannot update config file. Please set public write permissions on lib/".$settingsFile." and try again');</script>";
159+
echo "<script>top.ICEcoder.message('".$t['Cannot update config...']." lib/".$settingsFile." ".$t['and try again']."');</script>";
159160
}
160161
}
161162
}
@@ -172,7 +173,7 @@
172173

173174
<body class="githubManager">
174175

175-
<h1>github paths</h1>
176+
<h1><?php echo $t['github paths'];?></h1>
176177

177178
<div style="display: inline-block; width: 620px; height: 340px; overflow-y: auto">
178179
<?php
@@ -181,25 +182,25 @@
181182
if (count($pathsLocal) > 0) {
182183
?>
183184
<div style="display: inline-block; width: 600px; margin-bottom: 30px">
184-
<h2>Choose existing path</h2><br>
185+
<h2><?php echo $t['Choose existing path'];?></h2><br>
185186

186187
<form id="githubUpdateForm" action="github-manager.php?action=update" method="POST">
187188
<table>
188189
<tr>
189-
<td style="padding-left: 5px">Local path</td>
190-
<td style="padding-left: 5px">Remote GitHub path</td>
190+
<td style="padding-left: 5px"><?php echo $t['Local path'];?></td>
191+
<td style="padding-left: 5px"><?php echo $t['Remote GitHub path'];?></td>
191192
</tr>
192193
<?php
193194
for ($i=0; $i<count($pathsLocal); $i++) {
194195
echo '<tr>';
195196
echo '<td style="padding: 0 10px 8px 0"><input type="text" name="githubLocalPath'.$i.'" value="'.$pathsLocal[$i].'" style="width: 250px"></td>';
196197
echo '<td style="padding: 0 10px 8px 0"><input type="text" name="githubRemotePath'.$i.'" value="'.$pathsRemote[$i].'" style="width: 250px"></td>';
197-
echo '<td style="padding: 2px 0 8px 0"><div style="display: inline-block; padding: 5px; background: #2187e7; color: #fff; font-size: 12px; cursor: pointer" onclick="window.location=\'github-manager.php?action=choose&pathPair='.$i.'&csrf='.$_SESSION["csrf"].'\'">Choose</div></td>';
198+
echo '<td style="padding: 2px 0 8px 0"><div style="display: inline-block; padding: 5px; background: #2187e7; color: #fff; font-size: 12px; cursor: pointer" onclick="window.location=\'github-manager.php?action=choose&pathPair='.$i.'&csrf='.$_SESSION["csrf"].'\'">'.$t['Choose'].'</div></td>';
198199
echo '</tr>';
199200
}
200201
echo '<tr>';
201-
echo '<td style="padding-top: 7px; color: #444">Set local and remote path to blanks to remove</td>';
202-
echo '<td style="padding: 3px 10px 8px 0; text-align: right"><div style="display: inline-block; padding: 5px; background: #2187e7; color: #fff; font-size: 12px; cursor: pointer" onclick="document.getElementById(\'githubUpdateForm\').submit()">Update</div></td>';
202+
echo '<td style="padding-top: 7px; color: #444">'.$t['Set local and...'].'</td>';
203+
echo '<td style="padding: 3px 10px 8px 0; text-align: right"><div style="display: inline-block; padding: 5px; background: #2187e7; color: #fff; font-size: 12px; cursor: pointer" onclick="document.getElementById(\'githubUpdateForm\').submit()">'.$t['Update'].'</div></td>';
203204
echo '</tr>';
204205
?>
205206
</table>
@@ -211,32 +212,32 @@
211212
?>
212213

213214
<div style="display: inline-block; width: 600px">
214-
<h2>Add new path</h2><br>
215+
<h2><?php echo $t['Add new path'];?></h2><br>
215216

216217
<form id="githubAddForm" action="github-manager.php?action=add" method="POST">
217218
<table>
218219
<tr>
219-
<td style="padding-left: 5px">Local path</td>
220-
<td style="padding-left: 5px">Remote GitHub path</td>
220+
<td style="padding-left: 5px"><?php echo $t['Local path'];?></td>
221+
<td style="padding-left: 5px"><?php echo $t['Remote GitHub path'];?></td>
221222
</tr>
222223
<tr>
223224
<td style="padding: 0 10px 8px 0"><input type="text" name="githubLocalPathNEW" value="" style="width: 250px"></td>
224225
<td style="padding: 0 0 8px 0"><input type="text" name="githubRemotePathNEW" value="" style="width: 250px"></td>
225226
</tr>
226227
<tr>
227-
<td colspan="2" style="padding: 3px 0 8px 0; text-align: right"><div style="display: inline-block; padding: 5px; background: #2187e7; color: #fff; font-size: 12px; cursor: pointer" onclick="document.getElementById('githubAddForm').submit()">Add</div></td>
228+
<td colspan="2" style="padding: 3px 0 8px 0; text-align: right"><div style="display: inline-block; padding: 5px; background: #2187e7; color: #fff; font-size: 12px; cursor: pointer" onclick="document.getElementById('githubAddForm').submit()"><?php echo $t['Add'];?></div></td>
228229
</tr>
229230
</table>
230231
<input type="hidden" name="csrf" value="<?php echo $_SESSION["csrf"]; ?>">
231232
</form>
232233
</div>
233234

234-
<h2 style="margin-bottom: 10px">Usage Info:</h2>
235+
<h2 style="margin-bottom: 10px"><?php echo $t['Usage Info'];?></h2>
235236

236-
<p style="color: #888; margin: 0 10px 10px 0">Enter relative local paths (eg /server/myfiles) and absolute GitHub paths (eg https://github.com/user/repo or https://github.com/user/repo/tree/branch for branches), as per the examples. With this done you have established the source paths at both locations, as a pair.</p>
237-
<p style="color: #888; margin: 0 10px 10px 0">You can then choose a path pair and this then becomes your new root path in ICEcoder.</p>
238-
<p style="color: #888; margin: 0 10px 10px 0">The file manager then displays a new GitHub icon, which you can click on to perform and show a diff check between the 2 sources. These diffs can then be committed and pushed to the remote path at GitHub or cloned to your local path, to sync your files.</p>
239-
<p style="color: #888; margin: 0 10px 0 0">If you want to set another root path, this can be done in the Help > Settings screen.</p>
237+
<p style="color: #888; margin: 0 10px 10px 0"><?php echo $t['Enter relative local...'];?></p>
238+
<p style="color: #888; margin: 0 10px 10px 0"><?php echo $t['You can then...'];?></p>
239+
<p style="color: #888; margin: 0 10px 10px 0"><?php echo $t['The file manager...'];?></p>
240+
<p style="color: #888; margin: 0 10px 0 0"><?php echo $t['If you want...'];?></p>
240241

241242
</div>
242243

lib/github.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
<?php
22
include("headers.php");
33
include("settings.php");
4+
$t = $text['github'];
45

56
// SSL check, as everything is over https
67
$wrappers = stream_get_wrappers();
78
$sslAvail = true;
89
if (!extension_loaded('openssl') || !in_array('https', $wrappers)) {
910
$sslAvail = false;
10-
echo "<script>top.ICEcoder.message('Sorry, you don\'t appear to have OpenSSL loaded on your PHP instance, so https is not available. This is required for GitHub data transfer, please amend php.ini settings, restart your server and try again');top.ICEcoder.showHide('hide',top.get('loadingMask'));</script>";
11+
echo "<script>top.ICEcoder.message('".$t['Sorry, you do...']."');top.ICEcoder.showHide('hide',top.get('loadingMask'));</script>";
1112
die();
1213
}
1314

lib/headers.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
<?php
22
// Load common functions
33
include_once(dirname(__FILE__)."/settings-common.php");
4+
$text = $_SESSION['text'];
5+
$t = $text['headers'];
46

57
// CSRF synchronizer token pattern, 32 chars
68
if (!isset($_SESSION["csrf"])) {
7-
$_SESSION["csrf"] = md5(uniqid(mt_rand(), true));
9+
$_SESSION["csrf"] = md5(uniqid(mt_rand(), true));
810
}
911

1012
if (($_GET || $_POST) && (!isset($_REQUEST["csrf"]) || $_REQUEST["csrf"] !== $_SESSION["csrf"])) {
1113
$req = isset($_REQUEST["csrf"]) ? xssClean($_REQUEST["csrf"],"html") : "";
12-
die("Bad CSRF token. Please report the error info at https://github.com/mattpass/ICEcoder so it can be fixed.<br><br>
14+
die($t['Bad CSRF token...']."<br><br>
1315
CSRF issue:<br>
1416
REQUEST: ".$req."<br>
1517
SESSION: ".xssClean($_SESSION["csrf"],"html")."<br>
1618
FILE: ".xssClean($_SERVER["SCRIPT_NAME"],"html")."<br>
1719
GET: ".xssClean(var_export($_GET, true),"html")."<br>
18-
POST: ".xssClean(var_export($_POST, true),"html")."<br>
19-
<br>Many thanks!");
20+
POST: ".xssClean(var_export($_POST, true),"html"));
2021
}
2122

2223
// Set our security related headers

0 commit comments

Comments
 (0)