Skip to content
This repository has been archived by the owner on Apr 17, 2024. It is now read-only.

Commit

Permalink
update: database files
Browse files Browse the repository at this point in the history
remove: image proxy key
  • Loading branch information
darkalchemy committed Sep 2, 2018
1 parent 762666d commit c8b16d3
Show file tree
Hide file tree
Showing 15 changed files with 80 additions and 40 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
02 Sept, 2018
update: database files
remove: image proxy key
update: remove leading dots in cookie_domain example
add: tag @username anywhere
update: add columns year, rating updated from api calls
Expand Down
4 changes: 0 additions & 4 deletions cache/class_config.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
define('UC_SYSOP', 6);
define('UC_MAX', 6);



$class_names = [
UC_USER => 'USER',
UC_POWER_USER => 'POWER USER',
Expand All @@ -23,7 +21,6 @@
UC_SYSOP => 'SYSOP',
];


$class_colors = [
UC_USER => '8e35ef',
UC_POWER_USER => 'f9a200',
Expand All @@ -34,7 +31,6 @@
UC_SYSOP => '61df00',
];


$class_images = [
UC_USER => $site_config['pic_baseurl'] . 'class/user.gif',
UC_POWER_USER => $site_config['pic_baseurl'] . 'class/power.gif',
Expand Down
2 changes: 1 addition & 1 deletion chat/js/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -1448,7 +1448,7 @@ var ajaxChat = {
},

getChatListUserNameTitle: function (userID, userName, userRole, ip) {
return this.userRole >= UC_ADMINISTRATOR && ip !== '127.0.0.1' && ip !== null ? ' title="IP: ' + ip + '"' : ' title="Click to @mention "';
return this.userRole >= UC_ADMINISTRATOR && ip !== '127.0.0.1' && ip !== null ? ' title="IP: ' + ip + '"' : ' title="Click to @tag "';
},

getMessageDocumentID: function (messageID) {
Expand Down
6 changes: 3 additions & 3 deletions database/trivia.php.sql

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions database/tvmaze.php.sql

Large diffs are not rendered by default.

5 changes: 1 addition & 4 deletions public/install/extra/config.phpsample.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
$site_config['sessionName'] = '#sessionName'; // A single word that identifies this install.
$site_config['cookie_prefix'] = '#cookie_prefix_'; // This allows you to have multiple trackers, eg for demos, testing etc.
$site_config['cookie_path'] = '#cookie_path'; // generally '/' is good
$site_config['cookie_domain'] = '#cookie_domain'; // set to eg: somedomain.com or is subdomain set to: sub.somedomain.com
$site_config['cookie_domain'] = '#cookie_domain'; // set to eg: somedomain.com or is subdomain set to: sub.somedomain.com, add leading '.' to include your entire (sub)domain
$site_config['cookie_lifetime'] = '#cookie_lifetime'; // length of time cookies will be valid
$site_config['domain'] = '#domain';
$site_config['sessionKeyPrefix'] = '#cookie_prefix_'; // useful if serving multiple sites
Expand All @@ -17,9 +17,6 @@
$site_config['staff']['staff_pin'] = '#pass4'; // random generated during install
$site_config['staff']['owner_pin'] = '#pass5'; // random generated during install
$site_config['tracker_post_key'] = '#pass6'; // random generated during install
$site_config['image_proxy_key'] = [
'uid' => 'key',
]; // assigned by the image proxy host

// Site Bot
$site_config['chatBotName'] = '#bot_username';
Expand Down
14 changes: 7 additions & 7 deletions public/install/extra/data.php.sql

Large diffs are not rendered by default.

23 changes: 20 additions & 3 deletions public/install/extra/schema.php.sql
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ CREATE TABLE `failedlogins` (
`banned` enum('yes','no') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'no',
`attempts` int(10) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `ip` (`ip`)
UNIQUE KEY `ip` (`ip`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;

Expand Down Expand Up @@ -1079,6 +1079,7 @@ CREATE TABLE `images` (
`imdb_id` char(9) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`type` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`isbn` char(13) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `url_type` (`url`,`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
Expand Down Expand Up @@ -1370,6 +1371,20 @@ CREATE TABLE `offers` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `options`
--

DROP TABLE IF EXISTS `options`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `options` (
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`value` text COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `over_forums`
--
Expand Down Expand Up @@ -2165,6 +2180,9 @@ CREATE TABLE `torrents` (
`sticky` enum('yes','fly','no') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'no',
`anonymous` enum('yes','no') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'no',
`url` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`imdb_id` char(9) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`year` char(4) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`rating` decimal(2,1) NOT NULL DEFAULT '0.0',
`checked_by` int(10) unsigned NOT NULL DEFAULT '0',
`points` int(10) unsigned NOT NULL DEFAULT '0',
`allow_comments` enum('yes','no') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'yes',
Expand Down Expand Up @@ -2488,7 +2506,6 @@ CREATE TABLE `users` (
`pirate` int(11) unsigned NOT NULL DEFAULT '0',
`king` int(11) unsigned NOT NULL DEFAULT '0',
`hidecur` enum('yes','no') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'no',
`ssluse` int(1) NOT NULL DEFAULT '0',
`signature_post` enum('yes','no') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'yes',
`forum_post` enum('yes','no') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'yes',
`avatar_rights` enum('yes','no') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'yes',
Expand Down Expand Up @@ -2655,4 +2672,4 @@ CREATE TABLE `wiki` (
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2018-08-22 10:50:59
-- Dump completed on 2018-09-02 23:19:02
3 changes: 3 additions & 0 deletions src/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ public function update_row($key, $set, $ttl = 0)
$this->commit();
}

/**
* @return bool
*/
public function flushDB()
{
if ($_ENV['CACHE_DRIVER'] === 'redis') {
Expand Down
7 changes: 7 additions & 0 deletions src/Comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ public function __construct()
$this->site_config = $site_config;
}

/**
* @param int $tid
* @param int $count
* @param int $perpage
*
* @return array
*/
public function get_torrent_comment(int $tid, int $count, int $perpage)
{
require_once INCL_DIR . 'pager_functions.php';
Expand Down
11 changes: 3 additions & 8 deletions src/Cookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ class Cookie
protected $key;
private $fluent;

/**
* Cookie constructor.
*
* @param $key
*
* @throws \MatthiasMullie\Scrapbook\Exception\Exception
* @throws \MatthiasMullie\Scrapbook\Exception\ServerUnhealthy
*/
public function __construct($key)
{
global $site_config, $cache, $fluent;
Expand Down Expand Up @@ -69,6 +61,9 @@ public function getToken()
}
}

/**
* @throws \Exception
*/
public function reset_expire()
{
$cookie = $this->getToken();
Expand Down
26 changes: 22 additions & 4 deletions src/FailedLogin.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,28 @@ public function __construct()
$this->site_config = $site_config;
}

/**
* @param string $ip
*
* @return mixed
*/
public function get(string $ip)
{
$fails = $this->fluent->from('failedlogins')
->select(null)
->select('SUM(attempts) AS attempts')
->where('INET6_NTOA(ip) = ?', $ip)
->fetch('attempts');
->select(null)
->select('SUM(attempts) AS attempts')
->where('INET6_NTOA(ip) = ?', $ip)
->fetch('attempts');

return $fails;
}

/**
* @param array $set
* @param string $ip
*
* @throws \Exception
*/
public function set(array $set, string $ip)
{
$this->fluent->update('failedlogins')
Expand All @@ -36,13 +47,20 @@ public function set(array $set, string $ip)
->execute();
}

/**
* @param array $values
* @param array $update
*/
public function insert(array $values, array $update)
{
$this->fluent->insertInto('failedlogins', $values)
->onDuplicateKeyUpdate($update)
->execute();
}

/**
* @param string $ip
*/
public function delete(string $ip)
{
$this->fluent->deleteFrom('failedlogins')
Expand Down
7 changes: 6 additions & 1 deletion src/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@ public function __construct()
$this->fluent = $fluent;
}

/**
* @param array $values
*
* @throws \Exception
*/
public function insert(array $values)
{
$query = $this->fluent->insertInto('images')
$this->fluent->insertInto('images')
->values($values)
->ignore()
->execute();
Expand Down
2 changes: 1 addition & 1 deletion src/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function start()
// Set the session name:
session_name($this->config['sessionName']);

$secure_session = 'https' === get_scheme() ? true : false;
$secure_session = get_scheme() === 'https' ? true : false;
$domain = $this->config['cookie_domain'] === $this->config['domain'] ? '' : $this->config['cookie_domain'];

// Set session cookie parameters:
Expand Down
4 changes: 2 additions & 2 deletions templates/1/files.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ function get_file_name($file)
case 'index_js':
return "{$site_config['baseurl']}/js/1/index_3479219a.js";
case 'chat_js':
return "{$site_config['baseurl']}/js/1/chat_895fe7cb.js";
return "{$site_config['baseurl']}/js/1/chat_7c41aea5.js";
case 'chat_log_js':
return "{$site_config['baseurl']}/js/1/chat_log_2d8fc364.js";
return "{$site_config['baseurl']}/js/1/chat_log_8b5b6763.js";
case 'browse_js':
return "{$site_config['baseurl']}/js/1/browse_74f9954e.js";
case 'userdetails_js':
Expand Down

0 comments on commit c8b16d3

Please sign in to comment.