From 232aa1924c8c0f10d87b210b46c9f061af5c844c Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Sun, 17 Oct 2010 13:29:57 +0000 Subject: added files --- .../Application/Controllers/DownloadController.php | 199 +++++++++++++++++++++ 1 file changed, 199 insertions(+) create mode 100644 h-source/Application/Controllers/DownloadController.php (limited to 'h-source/Application/Controllers/DownloadController.php') diff --git a/h-source/Application/Controllers/DownloadController.php b/h-source/Application/Controllers/DownloadController.php new file mode 100644 index 0000000..4952456 --- /dev/null +++ b/h-source/Application/Controllers/DownloadController.php @@ -0,0 +1,199 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class DownloadController extends BaseController +{ + + public function __construct($model, $controller, $queryString) + { + + $this->_topMenuClasses['download'] = " class='currentitem'"; + + parent::__construct($model, $controller, $queryString); + + $this->model('HardwareModel'); + + $data['title'] = 'download - '.Website::$generalName; + $this->append($data); + } + + public function index($lang = 'en') + { + $this->cleverLoad('index'); + $this->right($lang); + } + + //get the xml of the archive + private function getXml($res) + { + $xml = null; + $xml = "\n"; + $xml .= "\n"; + $xml .= "\t\n"; + $xml .= "\t\th-node project\n"; + $xml .= "\t\twww.h-node.com\n"; + $xml .= "\t\t".date("Y-m-d h:m:s")."\n"; + $xml .= "\t\tThe contents of this page are in the Public Domain (see the CC0 page at http://creativecommons.org/publicdomain/zero/1.0/ for detailed information). Anyone is free to copy, modify, publish, use, sell, or distribute the text for any purpose, commercial or non-commercial, and by any means.\n"; + $xml .= "\t\n"; + + foreach ($res as $row) + { + $type = $row['hardware']['type']; + $xml .= "\t\n"; + + $xml .= "\t\t".$row['hardware']['id_hard']."\n"; + $xml .= "\t\t".$row['hardware']['type']."\n"; + + if ($type === 'notebook') + { + $xml .= "\t\t".$row['hardware']['subtype']."\n"; + } + + $xml .= "\t\t".$row['hardware']['model']."\n"; + + if ($type !== 'notebook') + { + $xml .= "\t\t".$row['hardware']['pci_id']."\n"; + } + + $xml .= "\t\t".$row['hardware']['vendor']."\n"; + $xml .= "\t\t".$row['hardware']['kernel']."\n"; + $xml .= "\t\t".$row['hardware']['distribution']."\n"; + $xml .= "\t\t".$row['hardware']['comm_year']."\n"; + if ($type !== 'notebook') + { + $xml .= "\t\t".$row['hardware']['interface']."\n"; + } + + if ($type === 'notebook' or $type === 'printer' or $type === 'scanner') + { + $xml .= "\t\t".$row['hardware']['compatibility']."\n"; + } + + if ($type === 'notebook') + { + $xml .= "\t\t".$row['hardware']['wifi_type']."\n"; + $xml .= "\t\t".$row['hardware']['video_card_type']."\n"; + } + + if ($type === 'notebook' or $type === 'wifi') + { + $xml .= "\t\t".$row['hardware']['wifi_works']."\n"; + } + + if ($type === 'notebook' or $type === 'videocard') + { + $xml .= "\t\t".$row['hardware']['video_card_works']."\n"; + } + if ($type === 'printer' or $type === 'scanner') + { + $xml .= "\t\t".$row['hardware']['driver']."\n"; + } + $xml .= "\t\t\n"; + + $xml .= "\t\t".$this->baseUrl."/".MyStrings::$reverse[$type]."/view/".$this->lang."/".$row['hardware']['id_hard']."/".encodeUrl($row['hardware']['model'])."\n"; + $xml .= "\t\t".$this->baseUrl."/".MyStrings::$reverse[$type]."/history/".$this->lang."/".$row['hardware']['id_hard']."\n"; + + $xml .= "\t\n"; + } + + $xml .= "\n"; + + return $xml; + } + + public function all($lang = 'en') + { + header ("Content-Type:text/xml"); + + $res = $this->m['HardwareModel']->clear()->select()->where(array('-deleted'=>'no'))->orderBy("type,hardware.id_hard")->send(); + + $data['xml'] = $this->getXml($res); + + $this->append($data); + $this->clean(); + $this->load('xml'); + } + + public function notebooks($lang = 'en') + { + header ("Content-Type:text/xml"); + + $res = $this->m['HardwareModel']->clear()->select()->where(array('type'=>'notebook','-deleted'=>'no'))->orderBy("type,hardware.id_hard")->send(); + + $data['xml'] = $this->getXml($res); + + $this->append($data); + $this->clean(); + $this->load('xml'); + } + + public function wifi($lang = 'en') + { + header ("Content-Type:text/xml"); + + $res = $this->m['HardwareModel']->clear()->select()->where(array('type'=>'wifi','-deleted'=>'no'))->orderBy("type,hardware.id_hard")->send(); + + $data['xml'] = $this->getXml($res); + + $this->append($data); + $this->clean(); + $this->load('xml'); + } + + public function videocards($lang = 'en') + { + header ("Content-Type:text/xml"); + + $res = $this->m['HardwareModel']->clear()->select()->where(array('type'=>'videocard','-deleted'=>'no'))->orderBy("type,hardware.id_hard")->send(); + + $data['xml'] = $this->getXml($res); + + $this->append($data); + $this->clean(); + $this->load('xml'); + } + + public function printers($lang = 'en') + { + header ("Content-Type:text/xml"); + + $res = $this->m['HardwareModel']->clear()->select()->where(array('type'=>'printer','-deleted'=>'no'))->orderBy("type,hardware.id_hard")->send(); + + $data['xml'] = $this->getXml($res); + + $this->append($data); + $this->clean(); + $this->load('xml'); + } + + public function scanners($lang = 'en') + { + header ("Content-Type:text/xml"); + + $res = $this->m['HardwareModel']->clear()->select()->where(array('type'=>'scanner','-deleted'=>'no'))->orderBy("type,hardware.id_hard")->send(); + + $data['xml'] = $this->getXml($res); + + $this->append($data); + $this->clean(); + $this->load('xml'); + } +} \ No newline at end of file -- cgit v1.2.3