aboutsummaryrefslogtreecommitdiff
path: root/h-source
diff options
context:
space:
mode:
Diffstat (limited to 'h-source')
-rw-r--r--h-source/Application/Controllers/BaseController.php2
-rw-r--r--h-source/Application/Include/distributions.php36
-rw-r--r--h-source/Application/Models/DistrosModel.php32
3 files changed, 43 insertions, 27 deletions
diff --git a/h-source/Application/Controllers/BaseController.php b/h-source/Application/Controllers/BaseController.php
index 2355569..4644fc1 100644
--- a/h-source/Application/Controllers/BaseController.php
+++ b/h-source/Application/Controllers/BaseController.php
@@ -164,6 +164,8 @@ class BaseController extends Controller
//link to the "discover your hardware" wiki page
$data['discoverYourHardwareLink'] = $this->getModule(array('right_column','discover_your_hardware'));
+ Distributions::setAllowedList();
+
$this->append($data);
}
diff --git a/h-source/Application/Include/distributions.php b/h-source/Application/Include/distributions.php
index 042ab6e..0572802 100644
--- a/h-source/Application/Include/distributions.php
+++ b/h-source/Application/Include/distributions.php
@@ -23,39 +23,21 @@ if (!defined('EG')) die('Direct access not allowed!');
class Distributions
{
- public static $allowed = array(
- 'blag_90001' => 'BLAG 90001',
- 'blag_120000' => 'BLAG 120000',
- 'blag_140000' => 'BLAG 140000',
- 'dragora_1_1' => 'Dragora 1.1',
- 'dragora_2_0' => 'Dragora 2.0 Ardi',
- 'dragora_2_2' => 'Dragora 2.2 Rafaela',
- 'dynebolic_2_5_2' => 'Dyne:bolic 2.5.2 DHORUBA',
- 'dynebolic_3_0_X' => 'Dyne:III 3.0.X MUNIR',
- 'gnewsense_2_3' => 'gNewSense 2.3 Deltah',
- 'gnewsense_3_0' => 'gNewSense 3.0 Metad (beta)',
- 'gnewsense_3_0_parkes' => 'gNewSense 3.0 Parkes',
- 'musix_2_0' => 'Musix GNU+Linux 2.0 R0',
- 'parabola' => 'Parabola GNU/Linux',
- 'trisquel_3_5' => 'Trisquel 3.5 Awen',
- 'trisquel_4_0' => 'Trisquel 4.0 Taranis',
- 'trisquel_4_5' => 'Trisquel 4.5 Slaine',
- 'trisquel_5_0' => 'Trisquel 5.0 Dagda',
- 'trisquel_5_5' => 'Trisquel 5.5 Brigantia',
- 'trisquel_6_0' => 'Trisquel 6.0 Toutatis',
- 'ututo_xs_2009' => 'UTUTO XS 2009',
- 'ututo_xs_2010' => 'UTUTO XS 2010',
- 'ututo_xs_2012_04' => 'UTUTO XS 2012.04',
- 'venenux_0_8' => 'VENENUX 0.8',
- 'venenux_0_8_2' => 'VENENUX-EC 0.8.2',
- 'venenux_0_9' => 'VENENUX 0.9',
- );
+ public static $allowed = array();
public static function getList()
{
return implode(' , ',array_keys(self::$allowed));
}
+ //fill the $allowed property with the list of allowed distros from the distros MySQL table
+ public function setAllowedList()
+ {
+ $distros = new DistrosModel();
+
+ self::$allowed = $distros->clear()->toList("clean_name","full_name")->send();
+ }
+
public static function getName($distList = '')
{
$returnString = null;
diff --git a/h-source/Application/Models/DistrosModel.php b/h-source/Application/Models/DistrosModel.php
new file mode 100644
index 0000000..41e0c6a
--- /dev/null
+++ b/h-source/Application/Models/DistrosModel.php
@@ -0,0 +1,32 @@
+<?php
+
+// h-source, a web software to build a community of people that want to share their hardware information.
+// Copyright (C) 2010 Antonio Gallo (h-source-copyright.txt)
+//
+// This file is part of h-source
+//
+// h-source is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// h-source is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with h-source. If not, see <http://www.gnu.org/licenses/>.
+
+if (!defined('EG')) die('Direct access not allowed!');
+
+class DistrosModel extends Model_Tree {
+
+ public function __construct() {
+ $this->_tables = 'distros';
+ $this->_idFields = 'id_distro';
+
+ parent::__construct();
+ }
+
+} \ No newline at end of file