From dce7a865e9ab119d57943701aaacdd612b06bf32 Mon Sep 17 00:00:00 2001 From: Michael Babker Date: Sat, 9 May 2015 13:13:31 -0400 Subject: [PATCH] Truncate the item descriptions when inserting pull data into the database --- .../components/com_patchtester/PatchTester/Model/PullsModel.php | 2 +- .../PatchTester/View/Pulls/tmpl/default_items.php | 2 +- .../components/com_patchtester/install/sql/mysql/install.sql | 2 +- .../com_patchtester/install/sql/postgresql/install.sql | 2 +- .../components/com_patchtester/install/sql/sqlsrv/install.sql | 2 +- .../hathor/html/com_patchtester/pulls/default_items.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/administrator/components/com_patchtester/PatchTester/Model/PullsModel.php b/administrator/components/com_patchtester/PatchTester/Model/PullsModel.php index c73271c..006a004 100644 --- a/administrator/components/com_patchtester/PatchTester/Model/PullsModel.php +++ b/administrator/components/com_patchtester/PatchTester/Model/PullsModel.php @@ -343,7 +343,7 @@ class PullsModel extends \JModelDatabase foreach ($pulls as $pull) { // Build the data object to store in the database - $pullData = array($pull->number, $pull->title, $pull->body, $pull->html_url); + $pullData = array($pull->number, $pull->title, \JHtml::_('string.truncateComplex', $pull->body, 100), $pull->html_url); $data[] = implode($this->getDb()->quote($pullData), ','); } diff --git a/administrator/components/com_patchtester/PatchTester/View/Pulls/tmpl/default_items.php b/administrator/components/com_patchtester/PatchTester/View/Pulls/tmpl/default_items.php index b9cc56d..67eeaa6 100644 --- a/administrator/components/com_patchtester/PatchTester/View/Pulls/tmpl/default_items.php +++ b/administrator/components/com_patchtester/PatchTester/View/Pulls/tmpl/default_items.php @@ -20,7 +20,7 @@ foreach ($this->items as $i => $item) : pull_id; ?> - escape($item->title); ?> + escape($item->title); ?> diff --git a/administrator/components/com_patchtester/install/sql/mysql/install.sql b/administrator/components/com_patchtester/install/sql/mysql/install.sql index 26d189c..10a6159 100644 --- a/administrator/components/com_patchtester/install/sql/mysql/install.sql +++ b/administrator/components/com_patchtester/install/sql/mysql/install.sql @@ -2,7 +2,7 @@ CREATE TABLE IF NOT EXISTS `#__patchtester_pulls` ( `id` int(11) NOT NULL AUTO_INCREMENT, `pull_id` int(11) NOT NULL, `title` varchar(200) NOT NULL, - `description` varchar(5000) NOT NULL DEFAULT '', + `description` varchar(150) NOT NULL DEFAULT '', `pull_url` varchar(255) NOT NULL, PRIMARY KEY (`id`) ) DEFAULT CHARSET=utf8; diff --git a/administrator/components/com_patchtester/install/sql/postgresql/install.sql b/administrator/components/com_patchtester/install/sql/postgresql/install.sql index 71bd7ef..ed82985 100644 --- a/administrator/components/com_patchtester/install/sql/postgresql/install.sql +++ b/administrator/components/com_patchtester/install/sql/postgresql/install.sql @@ -2,7 +2,7 @@ CREATE TABLE IF NOT EXISTS "#__patchtester_pulls" ( "id" serial NOT NULL, "pull_id" bigint NOT NULL, "title" character varying(200) NOT NULL, - "description" character varying(5000) DEFAULT '' NOT NULL, + "description" character varying(150) DEFAULT '' NOT NULL, "pull_url" character varying(255) NOT NULL, PRIMARY KEY ("id") ); diff --git a/administrator/components/com_patchtester/install/sql/sqlsrv/install.sql b/administrator/components/com_patchtester/install/sql/sqlsrv/install.sql index 331aae3..cecc431 100644 --- a/administrator/components/com_patchtester/install/sql/sqlsrv/install.sql +++ b/administrator/components/com_patchtester/install/sql/sqlsrv/install.sql @@ -2,7 +2,7 @@ CREATE TABLE [#__patchtester_pulls] ( [id] [bigint] IDENTITY(1,1) NOT NULL, [pull_id] [bigint] NOT NULL, [title] [nvarchar](200) NOT NULL, - [description] [nvarchar](4000) NOT NULL DEFAULT '', + [description] [nvarchar](150) NOT NULL DEFAULT '', [pull_url] [nvarchar](255) NOT NULL, CONSTRAINT [PK_#__patchtester_pulls] PRIMARY KEY CLUSTERED ( diff --git a/administrator/templates/hathor/html/com_patchtester/pulls/default_items.php b/administrator/templates/hathor/html/com_patchtester/pulls/default_items.php index 4276275..893c029 100644 --- a/administrator/templates/hathor/html/com_patchtester/pulls/default_items.php +++ b/administrator/templates/hathor/html/com_patchtester/pulls/default_items.php @@ -21,7 +21,7 @@ foreach ($this->items as $i => $item) : pull_id; ?> -

+

escape($item->title); ?>