Skip to content

Commit

Permalink
No SQL injection in Poject_model.php
Browse files Browse the repository at this point in the history
Avoid potential SQL injections by either:
- ensuring all raw SQL query strings are passed through
  $this->db->escape()
- using parametrized queries of the form
  $this->db->query($sql, <params>)

The following unused functions are removed:
- get_projects_summary()
- get_projects_by_author_status()

There's also a _search_all_terms() that is called only once, and is
implemented weirdly. Inline it, and use the correct $this->db->like()
syntax.
  • Loading branch information
notartom committed Apr 29, 2023
1 parent 85dd5e3 commit faa493f
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 201 deletions.
4 changes: 2 additions & 2 deletions application/controllers/api/Feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ public function authors_get()
}
}

public function lastest_releases_get()
public function latest_releases_get()
{
$this->load->model('project_model');
$projects = $this->project_model->get_lastest_releases(10);
$projects = $this->project_model->get_latest_releases(10);

if ($projects)
{
Expand Down
4 changes: 0 additions & 4 deletions application/controllers/private/Stats.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ public function index($user_id = 0)

$this->load->model('project_model');

// This will not fully run - queries need re-write
//$this->data['active_stats'] = $this->project_model->get_projects_summary($user_id);
//$this->data['inactive_stats'] = $this->project_model->get_projects_summary($user_id, 'inactive');

$this->insertMethodCSS();
$this->insertMethodJS();

Expand Down
4 changes: 2 additions & 2 deletions application/controllers/rss/Rss.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function _build_sections()
function latest_releases()
{
$this->load->model('project_model');
$this->data['projects'] = $this->project_model->get_lastest_releases(10);
$this->data['projects'] = $this->project_model->get_latest_releases(10);

if ($this->data['projects'])
{
Expand Down Expand Up @@ -119,4 +119,4 @@ function latest_releases()

$this->load->view('rss/latest_releases', $this->data, FALSE);
}
}
}
Loading

0 comments on commit faa493f

Please sign in to comment.