Commit 7c281445 authored by Jorgen's avatar Jorgen

Add basic authentication

parent 545fd4d1
...@@ -325,6 +325,8 @@ class Typo extends CI_Model { ...@@ -325,6 +325,8 @@ class Typo extends CI_Model {
*/ */
function correctTypo(int $typoId, string $corrected) { function correctTypo(int $typoId, string $corrected) {
$correctPath = $this->config->item("correction_path"); $correctPath = $this->config->item("correction_path");
$user = $this->config->item("typos_user");
$password = $this->config->item("typos_password");
/* Получаем исправление */ /* Получаем исправление */
$this->db->select("m.link as link, m.text as text, m.comment as comment, m.context as context"); $this->db->select("m.link as link, m.text as text, m.comment as comment, m.context as context");
...@@ -341,7 +343,9 @@ class Typo extends CI_Model { ...@@ -341,7 +343,9 @@ class Typo extends CI_Model {
try { try {
$client = new \JsonRPC\Client($url); $client = new \JsonRPC\Client($url);
$client->getHttpClient()->withDebug(); $client->getHttpClient()->withDebug()
->withUsername($user)
->withPassword($password);
$client->fixTypo($correction->text, $corrected, $correction->context, $correction->link); $client->fixTypo($correction->text, $corrected, $correction->context, $correction->link);
} catch(ConnectionFailureException $e) { } catch(ConnectionFailureException $e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment