aboutsummaryrefslogtreecommitdiff
path: root/h-source/Application
diff options
context:
space:
mode:
Diffstat (limited to 'h-source/Application')
-rw-r--r--h-source/Application/Controllers/BaseController.php4
-rw-r--r--h-source/Application/Controllers/GenericController.php14
-rw-r--r--h-source/Application/Controllers/HistoryController.php22
-rw-r--r--h-source/Application/Controllers/SpecialController.php49
-rw-r--r--h-source/Application/Models/HistoryModel.php5
5 files changed, 71 insertions, 23 deletions
diff --git a/h-source/Application/Controllers/BaseController.php b/h-source/Application/Controllers/BaseController.php
index 697b79b..02db21d 100644
--- a/h-source/Application/Controllers/BaseController.php
+++ b/h-source/Application/Controllers/BaseController.php
@@ -136,7 +136,9 @@ class BaseController extends Controller
$data['lastModif'] = $this->m['HistoryModel']
->select()
- ->where(array('type'=>'hardware','gr'=>'registered'))
+ ->inner('hardware')
+ ->on('hardware.id_hard=history.id')
+ ->where(array('type'=>'hardware','gr'=>'registered','approved'=>'yes'))
->orderBy('id_history desc')
->limit(5)
->send();
diff --git a/h-source/Application/Controllers/GenericController.php b/h-source/Application/Controllers/GenericController.php
index 1539f9f..a5dd24c 100644
--- a/h-source/Application/Controllers/GenericController.php
+++ b/h-source/Application/Controllers/GenericController.php
@@ -87,13 +87,13 @@ class GenericController extends BaseController
{
$pci_id = $this->request->post('pci_id','','sanitizeAll');
$interface = $this->request->post('interface','not-defined','sanitizeAll');
-
+
if ($this->checkVendorId($interface))
{
if (strcmp($this->m['HardwareModel']->type,'notebook') !== 0)
{
$this->m['HardwareModel']->values['vendor'] = sanitizeAll(Vendors::getName($pci_id,$interface));
-
+
$this->m['HardwareModel']->databaseConditions['insert']['+checkUnique'] = 'pci_id|<i>VendorID:ProductID</i> is already present in the database. This means that the device you are trying to insert is already in the database';
}
@@ -104,15 +104,17 @@ class GenericController extends BaseController
{
if (strcmp($this->controller,'notebooks') === 0)
{
- session_start();
+ @session_start();
$_SESSION['notebook_inserted'] = 'yes';
}
- }
- if ($this->m['HardwareModel']->queryResult)
- {
$data['submission_response'] = 'executed';
}
+
+// if ($this->m['HardwareModel']->queryResult)
+// {
+// $data['submission_response'] = 'executed';
+// }
$this->viewRedirect($this->m['HardwareModel']->lastId);
}
diff --git a/h-source/Application/Controllers/HistoryController.php b/h-source/Application/Controllers/HistoryController.php
index a92f906..3b6e1d2 100644
--- a/h-source/Application/Controllers/HistoryController.php
+++ b/h-source/Application/Controllers/HistoryController.php
@@ -275,6 +275,7 @@ class HistoryController extends BaseController
'field_name' => '-deleted',
'actions' => array('devicehide','deviceshow'),
'group' => 'admin',
+ 'types_to_show' => 'device_app,device',
),
@@ -467,8 +468,15 @@ class HistoryController extends BaseController
if (in_array($clean['group'],$this->s['registered']->status['groups']))
{
$clean['type'] = $this->types[$type]['clean_type'];
+ $clean['typeInWhereClause'] = "'".$clean['type']."'";
- switch ($clean['type']) {
+ if (array_key_exists('types_to_show',$this->types[$type]))
+ {
+ $clean['typeInWhereClause'] = "'".implode("','",explode(',',$this->types[$type]['types_to_show']))."'";
+ }
+
+ switch ($clean['type'])
+ {
case 'user':
$data['object'] = 'user';
$data['box_class'] = 'details_of_actions_inner_user';
@@ -499,7 +507,17 @@ class HistoryController extends BaseController
break;
}
- $data['res'] = $this->m['HistoryModel']->select()->where(array('id'=>$clean['id'],'type'=>$clean['type'],'gr'=>$clean['group']))->send();
+ $data['res'] = $this->m['HistoryModel']
+ ->select()
+ ->where(
+ array
+ (
+ 'id'=>$clean['id'],
+ 'type'=>"in(".$clean['typeInWhereClause'].")",
+ 'gr'=>$clean['group'])
+ )
+ ->send();
+// echo $this->m['HistoryModel']->getQuery();
$data['md_action'] = array(
'hide' => 'hidden',
diff --git a/h-source/Application/Controllers/SpecialController.php b/h-source/Application/Controllers/SpecialController.php
index 6f17c2c..6ef632a 100644
--- a/h-source/Application/Controllers/SpecialController.php
+++ b/h-source/Application/Controllers/SpecialController.php
@@ -40,17 +40,17 @@ class SpecialController extends BaseController
{
switch ($action)
{
- case 'modifications':
- $data['title'] = 'last modifications - '.Website::$generalName;
-
- $whereClauseArray = array(
- 'gr' => 'registered',
- 'type' => 'hardware',
- );
-
- $viewFile = 'modifications';
-
- break;
+// case 'modifications':
+// $data['title'] = 'last modifications - '.Website::$generalName;
+//
+// $whereClauseArray = array(
+// 'gr' => 'registered',
+// 'type' => 'hardware',
+// );
+//
+// $viewFile = 'modifications';
+//
+// break;
case 'modactions':
$data['title'] = 'last moderations - '.Website::$generalName;
$data['viewTitle'] = 'List of actions carried out by moderators';
@@ -99,7 +99,30 @@ class SpecialController extends BaseController
{
$this->shift(1);
- $this->last($lang = 'en','modifications');
+ $data['title'] = 'last modifications - '.Website::$generalName;
+
+ $whereClauseArray = array(
+ 'gr' => 'registered',
+ 'type' => 'hardware',
+ 'approved' => 'yes',
+ );
+
+ $this->helper('Pages','special/'.$this->action.'/'.$this->lang,'page');
+
+ $this->m['HistoryModel']->clear()->inner('hardware')->on('hardware.id_hard=history.id')->select()->where($whereClauseArray)->orderBy('id_history desc');
+
+ $recordNumber = $this->m['HistoryModel']->rowNumber();
+ $page = $this->viewArgs['page'];
+
+ $this->m['HistoryModel']->limit = $this->h['Pages']->getLimit($page,$recordNumber,30);
+
+ $data['table'] = $this->m['HistoryModel']->send();
+
+ $data['pageList'] = $this->h['Pages']->render($page-5,11);
+
+ $this->append($data);
+ $this->load('modifications');
+ $this->right();
}
public function modactions($lang = 'en')
@@ -122,7 +145,7 @@ class SpecialController extends BaseController
protected function pagelist($lang = 'en', $type)
{
- switch($type)
+ switch ($type)
{
case 'deleted':
$whereArray = array('-deleted'=>'yes','approved'=>'yes');
diff --git a/h-source/Application/Models/HistoryModel.php b/h-source/Application/Models/HistoryModel.php
index 2176a4a..daeda1f 100644
--- a/h-source/Application/Models/HistoryModel.php
+++ b/h-source/Application/Models/HistoryModel.php
@@ -25,7 +25,10 @@ class HistoryModel extends Model_Tree {
public function __construct() {
$this->_tables = 'history';
$this->_idFields = 'id_history';
-
+
+ $this->_where=array(
+ 'approved' => 'hardware',
+ );
$this->orderBy = 'history.id_history';
$this->_popupFunctions = array(