This commit is contained in:
kindlm
2017-09-27 11:30:05 +02:00
14 changed files with 409 additions and 243 deletions
-46
View File
@@ -1,46 +0,0 @@
<?php
// TO BE UPDATED
/*
* This class requires only DB functionalities from CI
* CI_Hack couldn't be included here because this class is called every time an addon
* makes an API call, so it would raise a lot of "already declared" errors
*/
require_once(dirname(__FILE__).'/../vendor/codeigniter/framework/system/core/Model.php');
require_once(dirname(__FILE__).'/../application/core/FHC_Model.php');
require_once(dirname(__FILE__).'/../application/core/DB_Model.php');
/**
* This class is used to authenticate the addons on the core system
*/
class AddonAuthentication extends DB_Model
{
public function __construct()
{
parent::__construct(NULL);
}
/**
* It retrieves the password with the given username from ci_addons table
* CREATE TABLE ci_addons (
* username varchar(10),
* password varchar(40),
* enabled integer,
* CONSTRAINT ci_addons_pk UNIQUE(username));
*/
public function getPasswordByUsername($username)
{
$password = NULL;
$sql = "SELECT password FROM public.ci_addons WHERE enabled = 1 AND username = ?";
$result = $this->db->query($sql, array($username));
if(!is_null($result) && $result->num_rows() > 0)
{
$password = $result->row()->password;
}
return $password;
}
}
+2 -1
View File
@@ -406,7 +406,8 @@ class basis_db extends db
foreach ($matches as $mk => $match)
{
$values[$languages[$mk+1]] = $match[3] != '' ? stripcslashes($match[3]) : (strtolower($match[2]) == 'null' ? null : $match[2]);
if(isset($languages[$mk+1]))
$values[$languages[$mk+1]] = $match[3] != '' ? stripcslashes($match[3]) : (strtolower($match[2]) == 'null' ? null : $match[2]);
}
return $values;
}