mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
More space fixes
This commit is contained in:
@@ -289,7 +289,7 @@ class Widgets extends CI_Controller {
|
|||||||
private function prepare_last_seen_text($last_seen_days_ago) {
|
private function prepare_last_seen_text($last_seen_days_ago) {
|
||||||
if ($last_seen_days_ago === 0) {
|
if ($last_seen_days_ago === 0) {
|
||||||
return "Last seen less than a day ago";
|
return "Last seen less than a day ago";
|
||||||
}
|
}
|
||||||
if ($last_seen_days_ago === 1) {
|
if ($last_seen_days_ago === 1) {
|
||||||
return "Last seen yesterday";
|
return "Last seen yesterday";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create URL "slug" for each user that serves as an alias for a user_id.
|
* Create URL "slug" for each user that serves as an alias for a user_id.
|
||||||
* The purpose is to have user identifier for use in public URLs (i.e. for widget purposes)
|
* The purpose is to have user identifier for use in public URLs (i.e. for widget purposes)
|
||||||
* that is bound to one concrete user, as the widgets might contain privacy-sensitive data.
|
* that is bound to one concrete user, as the widgets might contain privacy-sensitive data.
|
||||||
* This slug is to "mask" the user_id in lieu of avoiding brute-force iteration over
|
* This slug is to "mask" the user_id in lieu of avoiding brute-force iteration over
|
||||||
* user_ids in URL that might be available in particular Wavelog instance.
|
* user_ids in URL that might be available in particular Wavelog instance.
|
||||||
*/
|
*/
|
||||||
class Migration_user_callsign_public_slug extends CI_Migration {
|
class Migration_user_callsign_public_slug extends CI_Migration {
|
||||||
@@ -15,25 +15,25 @@ class Migration_user_callsign_public_slug extends CI_Migration {
|
|||||||
{
|
{
|
||||||
// Step 1: Add user slug column
|
// Step 1: Add user slug column
|
||||||
if (!$this->db->field_exists('slug', 'users')) {
|
if (!$this->db->field_exists('slug', 'users')) {
|
||||||
$fields = array(
|
$fields = array(
|
||||||
'slug varchar(50) DEFAULT NULL'
|
'slug varchar(50) DEFAULT NULL'
|
||||||
);
|
);
|
||||||
$this->dbforge->add_column('users', $fields);
|
$this->dbforge->add_column('users', $fields);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 2: Create public user-slug for each user
|
// Step 2: Create public user-slug for each user
|
||||||
if (!$this->load->is_loaded('encryption')) {
|
if (!$this->load->is_loaded('encryption')) {
|
||||||
$this->load->library('encryption');
|
$this->load->library('encryption');
|
||||||
}
|
}
|
||||||
|
|
||||||
$fetch_result = $this->db->get($this->config->item('auth_table'));
|
$fetch_result = $this->db->get($this->config->item('auth_table'));
|
||||||
if ($fetch_result && $fetch_result->num_rows() > 0) {
|
if ($fetch_result && $fetch_result->num_rows() > 0) {
|
||||||
foreach ($fetch_result->result_array() as $user_row) {
|
foreach ($fetch_result->result_array() as $user_row) {
|
||||||
if ($user_row["slug"] === null) {
|
if ($user_row["slug"] === null) {
|
||||||
$user_name = $user_row["user_name"];
|
$user_name = $user_row["user_name"];
|
||||||
$user_slug_base = md5($this->encryption->encrypt($user_name));
|
$user_slug_base = md5($this->encryption->encrypt($user_name));
|
||||||
$url_slug = substr($user_slug_base, 0, USER_SLUG_LENGTH);
|
$url_slug = substr($user_slug_base, 0, USER_SLUG_LENGTH);
|
||||||
|
|
||||||
// update the slug only in case the slug does not exist yet
|
// update the slug only in case the slug does not exist yet
|
||||||
$user_id = $user_row["user_id"];
|
$user_id = $user_row["user_id"];
|
||||||
$this->db->where('user_id', $user_id);
|
$this->db->where('user_id', $user_id);
|
||||||
@@ -50,7 +50,7 @@ class Migration_user_callsign_public_slug extends CI_Migration {
|
|||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
if ($this->db->field_exists('slug', 'users')) {
|
if ($this->db->field_exists('slug', 'users')) {
|
||||||
$this->dbforge->drop_column('users', 'slug');
|
$this->dbforge->drop_column('users', 'slug');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user