Skip to content

Commit 990e171

Browse files
authored
Merge pull request #177 from Mdwiki-TD/update_new
1
2 parents 93f5147 + 262814a commit 990e171

31 files changed

+1985
-96
lines changed

src/Tables/lang_names.json

Lines changed: 1837 additions & 0 deletions
Large diffs are not rendered by default.

src/Tables/tables.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
//---
2121

2222
use function SQLorAPI\GetDataTab\get_td_or_sql_titles_infos;
23-
use function Tables\TablesDir\open_td_Tables_file;
2423

2524
//---
2625
class MainTables
@@ -38,10 +37,6 @@ class MainTables
3837
'langs_tables' => &MainTables::$x_Langs_table,
3938
);
4039
//---
41-
foreach ($tables_d as $key => &$value) {
42-
$value = open_td_Tables_file("jsons/{$key}.json");
43-
}
44-
4540
$titles_infos = get_td_or_sql_titles_infos();
4641

4742
foreach ($titles_infos as $k => $tab) {
@@ -57,3 +52,14 @@ class MainTables
5752
// ---
5853
MainTables::$x_Assessments_table[$title] = $tab['importance'];
5954
};
55+
56+
if (file_exists(__DIR__ . '/lang_names.json')) {
57+
$contents = file_get_contents(__DIR__ . '/lang_names.json');
58+
if ($contents !== false) {
59+
$data = json_decode($contents, true);
60+
if (is_array($data)) {
61+
MainTables::$x_Langs_table = $data;
62+
ksort(MainTables::$x_Langs_table);
63+
}
64+
}
65+
}

src/api_calls/curl_api.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function post_url_params_result(string $endPoint, array $params = []): string
1616

1717
curl_setopt($ch, CURLOPT_URL, $endPoint);
1818
curl_setopt($ch, CURLOPT_POST, true);
19-
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));
19+
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params, '', '&', PHP_QUERY_RFC3986));
2020
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
2121
// curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
2222
// curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
@@ -25,7 +25,7 @@ function post_url_params_result(string $endPoint, array $params = []): string
2525
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
2626

2727
$output = curl_exec($ch);
28-
$url = "{$endPoint}?" . http_build_query($params);
28+
$url = "{$endPoint}?" . http_build_query($params, '', '&', PHP_QUERY_RFC3986);
2929
// ---
3030
// remove "&format=json" from $url then make it link <a href="$url2">
3131
$url2 = str_replace('&format=json', '', $url);

src/api_calls/mdwiki_api.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function post_url_mdwiki(string $endPoint, array $params = []): string
1717
curl_setopt_array($ch, [
1818
CURLOPT_URL => $endPoint,
1919
CURLOPT_POST => true,
20-
CURLOPT_POSTFIELDS => http_build_query($params),
20+
CURLOPT_POSTFIELDS => http_build_query($params, '', '&', PHP_QUERY_RFC3986),
2121
CURLOPT_RETURNTRANSFER => true,
2222
CURLOPT_USERAGENT => $usr_agent,
2323
CURLOPT_CONNECTTIMEOUT => 5,
@@ -29,7 +29,7 @@ function post_url_mdwiki(string $endPoint, array $params = []): string
2929
// ---
3030
$output = curl_exec($ch);
3131
// ---
32-
$url = "{$endPoint}?" . http_build_query($params);
32+
$url = "{$endPoint}?" . http_build_query($params, '', '&', PHP_QUERY_RFC3986);
3333
// ---
3434
// remove "&format=json" from $url then make it link <a href="$url2">
3535
$url2 = str_replace('&format=json', '', $url);

src/api_calls/wiki_api.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function make_view_by_number($target, $numb, $lang, $pupdate)
2424
// 'range' => 'all-time',
2525
'redirects' => '0',
2626
'pages' => $target,
27-
));
27+
), '', '&', PHP_QUERY_RFC3986);
2828
// ---
2929
$numb3 = (is_numeric($numb2)) ? number_format($numb2) : $numb2;
3030
$link = "<a target='_blank' href='$url'>$numb3</a>";

src/api_or_sql/data_tab.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ function get_td_or_sql_users_no_inprocess()
192192
return $users;
193193
}
194194

195-
function get_td_or_sql_full_translators()
195+
function get_td_or_sql_full_translators($column = null)
196196
{
197197
// ---
198198
static $full_tr = [];
@@ -203,6 +203,10 @@ function get_td_or_sql_full_translators()
203203
$query = "SELECT * FROM full_translators";
204204
$full_tr = super_function($api_params, [], $query);
205205
// ---
206+
if ($column) {
207+
return array_column($full_tr, $column);
208+
}
209+
// ---
206210
return $full_tr;
207211
}
208212

src/auth.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?PHP
22
//---
3-
$stats = http_build_query($_GET);
3+
$stats = http_build_query($_GET, '', '&', PHP_QUERY_RFC3986);
44
//---
55
HEADER("Location: /auth/index.php?$stats");

src/coordinator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?PHP
22
//---
3-
$stats = http_build_query($_GET);
3+
$stats = http_build_query($_GET, '', '&', PHP_QUERY_RFC3986);
44
//---
55
HEADER("Location: /tdc/index.php?$stats");

src/include_first/html.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ function make_translation_url($title, $lang, $tr_type)
211211
//---
212212
$url = "//$lang.wikipedia.org/wiki/Special:ContentTranslation";
213213
//---
214-
// $url .= "?" . http_build_query($params) . "#/sx/sentence-selector";
215-
$url .= "?" . http_build_query($params) . "#/sx?previousRoute=dashboard&eventSource=direct_preselect";
214+
// $url .= "?" . http_build_query($params, '', '&', PHP_QUERY_RFC3986) . "#/sx/sentence-selector";
215+
$url .= "?" . http_build_query($params, '', '&', PHP_QUERY_RFC3986) . "#/sx?previousRoute=dashboard&eventSource=direct_preselect";
216216
//---
217217
// $url = "//$lang.wikipedia.org/wiki/Special:ContentTranslation?page=User%3AMr.+Ibrahem%2F$title&from=en&to=$lang&targettitle=$title#draft";
218218
//---

src/include_first/tables_dir.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function open_td_Tables_file($path, $echo = true)
1919
{
2020
$tables_dir = getenv("HOME") . '/public_html/td/Tables';
2121
//---
22-
if (substr($tables_dir, 0, 2) == 'I:') {
22+
if (substr(__DIR__, 0, 2) == 'I:') {
2323
$tables_dir = 'I:/mdwiki/mdwiki/public_html/td/Tables';
2424
}
2525
//---

0 commit comments

Comments
 (0)